quota磁盘配额(user)
1.开启配额功能:
[root@localhost /]# mount -o usrquota /dev/sda5 /mnt/
2.设置用户配额:
[root@localhost /]# edquota -u robin /mnt
3.查询配额的使用情况
[root@localhost /]# repquota -u /mnt
1.开启配额功能:
[root@localhost /]# mount -o usrquota /dev/sda5 /mnt/
2.设置用户配额:
[root@localhost /]# edquota -u robin /mnt
![](https://i-blog.csdnimg.cn/blog_migrate/f43c83afe91c4fc35ca0c7d91bf8ab61.png)
3.查询配额的使用情况
[root@localhost /]# repquota -u /mnt
![](https://i-blog.csdnimg.cn/blog_migrate/88abc958c99c5ffff72acf1cb0b9c751.png)
4.启动配额:
[root@localhost mnt]# quotaon /mnt/
![](https://i-blog.csdnimg.cn/blog_migrate/55d25ba4aabd39db188b49034d77a0b6.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://i-blog.csdnimg.cn/blog_migrate/f89e4a587edf950c17b93e0377884127.png)
测试文件个数配额
touch /mnt/abc{1..25}.txt
touch /mnt/abc{1..25}.txt
![](https://i-blog.csdnimg.cn/blog_migrate/585e11d231759be099a4dbb5f6a233ab.png)
group配额:
groupadd upup
useradd -g upup king
useradd -g upup zorro
groupadd upup
useradd -g upup king
useradd -g upup zorro
![](https://i-blog.csdnimg.cn/blog_migrate/e7db947fd1598b4b0d7f3649d20bb61d.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
[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://i-blog.csdnimg.cn/blog_migrate/99dd3cacc23bd8b9c607ae1e289a154f.png)
3.查询配额的使用情况
[root@localhost /]# repquota -g /mnt
[root@localhost /]# repquota -g /mnt
![](https://i-blog.csdnimg.cn/blog_migrate/16a49855803e4618fe1bb6610f44faba.png)
4.激活组配额
[root@localhost /]# quotaon -g /mnt/
![](https://i-blog.csdnimg.cn/blog_migrate/a68c68ee9d109460c1d0de09426fa9b6.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://i-blog.csdnimg.cn/blog_migrate/22c5cba51aa0cad6421092c0a75453bf.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://i-blog.csdnimg.cn/blog_migrate/b5824e47039236bf2257b25756ac4f0d.png)