2.验证配额
[root@localhost ~]# su - user1
[user1@localhost ~]$ cd /mnt/sdb
[user1@localhost sdb]$ dd if=/dev/zero of=12 bs=1M count=5 --创建5M的文件没有警告信息,正常
5+0 records in
5+0 records out
5242880 bytes (5.2 MB) copied, 0.0525754 s, 99.7 MB/s
[user1@localhost sdb]$ ll -h 12
-rw-rw-r--. 1 user1 user1 5.0M Jan 9 18:16 12
[user1@localhost sdb]$ dd if=/dev/zero of=123 bs=1M count=21 --创建12M的文件有警告信息,表示失败
sdb1: warning, user block quota exceeded.
sdb1: write failed, user block limit reached.
dd: writing `123': Disk quota exceeded
20+0 records in
19+0 records out
20475904 bytes (20 MB) copied, 0.20094 s, 102 MB/s
[user1@localhost sdb]$ ll -h 123
-rw-rw-r--. 1 user1 user1 0 Jan 9 18:17 123
[user1@localhost sdb]$ exit
logout
[root@localhost ~]# su - user2 --用户user2测试
[user2@localhost ~]$ cd /mnt/sdb
[user2@localhost sdb]$ dd if=/dev/zero of=23 bs=1M count=8 --写入8M文件成功
sdb1: warning, user block quota exceeded.
8+0 records in
8+0 records out
8388608 bytes (8.4 MB) copied, 0.0923618 s, 90.8 MB/s
[user2@localhost sdb]$ ll -h 23 --查看文件大小
-rw-rw-r--. 1 user2 user2 8.0M Jan 9 18:23 23
[user2@localhost sdb]$
[user2@localhost sdb]$ dd if=/dev/zero of=23 bs=1M count=11 --写入11M文件失败
sdb1: warning, user block quota exceeded.
sdb1: write failed, user block limit reached.
dd: writing `23': Disk quota exceeded
10+0 records in
9+0 records out
10235904 bytes (10 MB) copied, 0.106298 s, 96.3 MB/s
[user2@localhost sdb]$
3.查看quota配置,修改警告时间,取消quota
[root@localhost ~]# quota -vu user1 user2 --查找指定的用户quota信息
Disk quotas for user user1 (uid 500):
Filesystem blocks quota limit grace files quota limit grace
/dev/sdb1 0 10000 20000 0 0 0
Disk quotas for user user2 (uid 501):
Filesystem blocks quota limit grace files quota limit grace
/dev/sdb1 8193* 5000 10000 6days 1 0 0
[root@localhost ~]# repquota -av --所有用户和quota信息
*** Report for user quotas on device /dev/sdb1
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 13 0 0 2 0 0
user1 -- 0 10000 20000 0 0 0
user2 +- 8193 5000 10000 6days 1 0 0
Statistics:
Total blocks: 7
Data blocks: 1
Entries: 3
Used average: 3.000000
[root@localhost ~]# edquota -t --修改文件警告天数(Block 天数 Inode 天数)
Grace period before enforcing soft limits for users:
Time units may be: days, hours, minutes, or seconds
Filesystem Block grace period Inode grace period
/dev/sdb1 7days 7days
[root@localhost ~]# vim /etc/warnquota.conf --查看警告信息
[root@localhost ~]# quotaoff /mnt/sdb --关闭quota功能
推荐阅读: