RHEL5 quota测试

RHEL5 quota测试

1.编辑/etc/fstab使分区挂载的时候支持quota

LABEL=/home             /home                   ext3    usrquota,grpquota ,defaults        1 2

2.扫瞄磁盘的使用者使用状况,并产生重要的 aquota.group 与 aquota.user

[root@redhat home]# quotacheck -ug /home
[root@redhat home]# ls -l
total 112
   -rw------- 1 root      root       7168 Nov 11 10:09 aquota.group
-rw------- 1 root      root       7168 Nov 11 10:09 aquota.user

3.添加用户quotatest来进行quota测试

[root@redhat home]# useradd quotatest

4.edquota -u quotatest

Disk quotas for user quotatest (uid 504):
Filesystem                   blocks       soft       hard      inodes     soft     hard
/dev/sda8                        0         20000       20000          8        0        0
简单说明:红色那一组才是限制磁盘使用空间大小的,blocks不用管,默认0;soft和hard这下面两个值的单位是kb.

5.启用quota

[root@redhat home]# quotaon -a

6.测试

[quotatest@redhat ~]$ quota -vu
     Disk quotas for user quotatest (uid 504):
     Filesystem blocks   quota   limit   grace   files   quota   limit   grace
      /dev/sda8      40   20000   30000                5       0       0
[quotatest@redhat ~]$ dd if=/dev/zero of=test.db1 bs=1024k count=12
     12+0 records in
     12+0 records out
     12582912 bytes (13 MB) copied, 0.0510098 seconds, 247 MB/s
   [quotatest@redhat ~]$ quota -vu
     Disk quotas for user quotatest (uid 504):
     Filesystem blocks   quota   limit   grace   files   quota   limit   grace
      /dev/sda8   12348   20000   30000                6       0       0
[quotatest@redhat ~]$ dd if=/dev/zero of=test.db2 bs=1024k count=12
     sda8: warning, user block quota exceeded.
     12+0 records in
     12+0 records out
     12582912 bytes (13 MB) copied, 0.0429055 seconds, 293 MB/s
   [quotatest@redhat ~]$ quota -vu
     Disk quotas for user quotatest (uid 504):
     Filesystem blocks   quota   limit   grace   files   quota   limit   grace
      /dev/sda8   24656* 20000   30000   7days       7        0       0
[quotatest@redhat ~]$ dd if=/dev/zero of=test.db3 bs=1024k count=12
     sda8: write failed, user block limit reached.
     dd: writing `test.db3': Disk quota exceeded
     6+0 records in
     5+0 records out
     5455872 bytes (5.5 MB) copied, 0.0195092 seconds, 280 MB/s

[quotatest@redhat ~]$ quota -vu
     Disk quotas for user quotatest (uid 504):
     Filesystem blocks   quota   limit   grace   files   quota   limit   grace
      /dev/sda8   30000* 20000   30000                8       0       0
[quotatest@redhat ~]$

附加:如果需要对大量用户进行相同的quota操作,可以使用以一命令进行quota复制

    [root@redhat home]# edquota -p quotatest newuser

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值