centos7桌面能看到计算机,【14-10-29】 【总结】教你怎么将centos7打造成桌面系统。。。...

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

1.5.7 直接设置配额:setquota

[root@rhce ~]# setquota -h

setquota: Usage:

setquota [-u|-g] [-rm] [-F quotaformat]

-a|...

setquota [-u|-g] [-rm] [-F quotaformat] -a|...

setquota [-u|-g] [-rm] [-F quotaformat] -b[-c] -a|...

setquota [-u|-g] [-F quotaformat] -t -a|...

setquota [-u|-g] [-F quotaformat] -T-a|...

-u, --user set limits for user

-g, --group set limits for group

-a, --all set limits for allfilesystems

--always-resolve alwaystryto resolve name, even if is

composed onlyofdigits

-F, --format=formatname operate on specific quota format

-p, --prototype=protoname copy limits from user/group

-b, --batch read limits from standard input

-c, --continue-batch continue in input processing in caseofan error

-r, --remote set remote quota (via RPC)

-m, --no-mixed-pathnames trim leading slashes fromNFSv4mountpoints

-t, --edit-period edit grace period

-T, --edit-times edit grace times for user/group

-h, --help display this help text andexit

-V, --version display version informationandexit

Bugs to: jack@suse.cz

[root@rhce ~]#

二. 配额使用示例

2.1 创建分区并mount到目录

[root@rhce /]# fdisk /dev/sdc

Device contains neither a validDOSpartition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel withdiskidentifier 0x1e051117.

Changes will remain in memory only,untilyou decide to write them.

After that, of course, the previouscontentwon*t be recoverable.

Warning: invalid flag 0x0000 ofpartitiontable 4 will be corrected by w(rite)

WARNING: DOS-compatible mode isdeprecated.It*s strongly recommended to

switch off the mode (command *c*) and change display units to

sectors (command *u*).

Command (m for help): n

Command action

e extended

p primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-652, default 1):

Using default value 1

Last cylinder, +cylinders or+size{K,M,G}(1-652, default 652):

Using default value 652

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[root@rhce /]# fdisk -l

Disk /dev/sdc: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 =8225280bytes

Sector size (logical/physical): 512 bytes/512 bytes

I/O size (minimum/optimal): 512 bytes /512bytes

Disk identifier: 0x1e051117

Device Boot Start End Blocks Id System

/dev/sdc1 1 652 5237158+ 83 Linux

[root@rhce /]# mkfs -t ext3 /dev/sdc1

mke2fs 1.41.12 (17-May-2010)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

327680 inodes, 1309289 blocks

65464 blocks (5.00%) reserved for thesuperuser

First data block=0

Maximum filesystem blocks=1342177280

40 block groups

32768 blocks per group, 32768 fragmentspergroup

8192 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912, 819200, 884736

Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystemaccountinginformation: done

This filesystem will beautomaticallychecked every 30 mounts or

180 days, whichever comes first. Use tune2fs -c or -i to override.

[root@rhce /]#

[root@rhce /]# mount/dev/sdc1 /dave

[root@rhce /]# vim /etc/fstab

/dev/sdc1 /dave ext3 defaults 0 0

我们这里将/dev/sdc1映射到了目录/dave.

2.2 创建2个测试用户

[root@rhce /]# groupadd grp01

[root@rhce /]# groupadd grp02

[root@rhce /]# cat /etc/group|grep grp0*

grp01:x:503:

grp02:x:504:

[root@rhce /]#

[root@rhce /]# useradd dave01 -g grp01

[root@rhce /]# useradd dave02 -g grp02

[root@rhce /]# passwd dave01

Changing password for user dave01.

New password:

BAD PASSWORD: it is too short

BAD PASSWORD: is too simple

Retype new password:

passwd: all authentication tokensupdatedsuccessfully.

[root@rhce /]# passwd dave02

Changing password for user dave02.

New password:

BAD PASSWORD: it is too short

BAD PASSWORD: is too simple

Retype new password:

passwd: all authentication tokensupdatedsuccessfully.

[root@rhce /]#

2.3 修改分区表启用配额限制

[root@rhce ~]# cat /etc/fstab

tmpfs /dev/shm tmpfs defaults 0 0

devpts /dev/pts devpts gid=5,mode=620 0 0

sysfs /sys sysfs defaults 0 0

proc /proc proc defaults 0 0

/dev/sdc1 /dave ext3 defaults,usrquota,grpquot 0 0

[root@rhce ~]#

/etc/fstab 文件的第四个字段是装载文件系统是使用的选项:

(1)实现基于用户的磁盘配额,就加入usrquota关键字,

(2)实现基于组的磁盘配额,就加入grpqouta关键字,如果两者都需要,就全写入,中间可以用逗号分隔。

注意:请特别注意这里的拼写,是usrquota和grpquota,不要写成userquota和groupquota。

2.4 重新Remount 分区

[root@rhce ~]# mount

/dev/sda3 on / type ext4 (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

devpts on /dev/pts type devpts(rw,gid=5,mode=620)

tmpfs on /dev/shm typetmpfs(rw,rootcontext="system_u:object_r:tmpfs_t:s0")

/dev/sda1 on /boot type ext4 (rw)

none on /proc/sys/fs/binfmt_misctypebinfmt_misc (rw)

none on /sys/kernel/config typeconfigfs(rw)

sunrpc on /var/lib/nfs/rpc_pipefstyperpc_pipefs (rw)

gvfs-fuse-daemon on /root/.gvfstypefuse.gvfs-fuse-daemon (rw,nosuid,nodev)

/dev/sdc1 on /dave typeext3 (rw)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值