quota磁盘配额
quota磁盘配额(user)
1.开启配额功能:
[root@localhost /]# mount -o usrquota /dev/sda5 /mnt/
2.设置用户配额:
[root@localhost /]# edquota -u robin /mnt
![](https://img2018.cnblogs.com/blog/1715111/201906/1715111-20190613193528086-1686607893.png)
3.查询配额的使用情况
[root@localhost /]# repquota -u /mnt
1.开启配额功能:
[root@localhost /]# mount -o usrquota /dev/sda5 /mnt/
2.设置用户配额:
[root@localhost /]# edquota -u robin /mnt
![](https://img2018.cnblogs.com/blog/1715111/201906/1715111-20190613193528086-1686607893.png)
3.查询配额的使用情况
[root@localhost /]# repquota -u /mnt
![](https://img2018.cnblogs.com/blog/1715111/201906/1715111-20190615165722829-63363892.png)
4.启动配额:
[root@localhost mnt]# quotaon /mnt/
![](https://img2018.cnblogs.com/blog/1715111/201906/1715111-20190615165811270-1338903149.png)
测试:
测试空间配额
su - robin
dd if=/dev/zero of=/mnt/data bs=120M count=1
测试空间配额
su - robin
dd if=/dev/zero of=/mnt/data bs=120M count=1
dd: 写入"/mnt/data" 出错: 超出磁盘限额
![](https://img2018.cnblogs.com/blog/1715111/201906/1715111-20190615170048521-1759009558.png)
测试文件个数配额
touch /mnt/abc{1..25}.txt
touch /mnt/abc{1..25}.txt
![](https://img2018.cnblogs.com/blog/1715111/201906/1715111-20190615170325594-1556584454.png)
group配额:
groupadd upup
useradd -g upup king
useradd -g upup zorro
groupadd upup
useradd -g upup king
useradd -g upup zorro
![](https://img2018.cnblogs.com/blog/1715111/201906/1715111-20190615171811242-468437839.png)
1.开启组配额
[root@localhost /]# mount -o grpquota /dev/sda5 /mnt/
2.配置组配额
[root@localhost /]# edquota -g upup
Disk quotas for group upup (gid 1002):
Filesystem blocks soft hard inodes soft hard
/dev/sda5 0 51200 102400 0 10 20![](https://img2018.cnblogs.com/blog/1715111/201906/1715111-20190615172130855-2141217837.png)
[root@localhost /]# mount -o grpquota /dev/sda5 /mnt/
2.配置组配额
[root@localhost /]# edquota -g upup
Disk quotas for group upup (gid 1002):
Filesystem blocks soft hard inodes soft hard
/dev/sda5 0 51200 102400 0 10 20
![](https://img2018.cnblogs.com/blog/1715111/201906/1715111-20190615172130855-2141217837.png)
3.查询配额的使用情况
[root@localhost /]# repquota -g /mnt
[root@localhost /]# repquota -g /mnt
![](https://img2018.cnblogs.com/blog/1715111/201906/1715111-20190615172241734-237271603.png)
4.激活组配额
[root@localhost /]# quotaon -g /mnt/
![](https://img2018.cnblogs.com/blog/1715111/201906/1715111-20190615172321643-1627853590.png)
测试:
[root@localhost ~]# su - king
[king@localhost mnt]$ dd if=/dev/zero of=/mnt/data1 bs=80M count=1
[root@localhost ~]# su - king
[king@localhost mnt]$ dd if=/dev/zero of=/mnt/data1 bs=80M count=1
![](https://img2018.cnblogs.com/blog/1715111/201906/1715111-20190615172842561-504064846.png)
[root@localhost ~]# su - zorro
[zorro@localhost ~]$ dd if=/dev/zero of=/mnt/data2 bs=80M count=1
[zorro@localhost ~]$ dd if=/dev/zero of=/mnt/data2 bs=80M count=1
![](https://img2018.cnblogs.com/blog/1715111/201906/1715111-20190615173023345-1637832237.png)