quota磁盘配额
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
3.查询配额的使用情况
[root@localhost /]# repquota -u /mnt
4.启动配额:
[root@localhost mnt]# quotaon /mnt/
测试:
测试空间配额
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" 出错: 超出磁盘限额
测试文件个数配额
touch /mnt/abc{1..25}.txt
touch /mnt/abc{1..25}.txt
group配额:
groupadd upup
useradd -g upup king
useradd -g upup zorro
groupadd upup
useradd -g upup king
useradd -g upup zorro
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
3.查询配额的使用情况
[root@localhost /]# repquota -g /mnt
[root@localhost /]# repquota -g /mnt
4.激活组配额
[root@localhost /]# quotaon -g /mnt/
测试:
[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
[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