quota磁盘配额
Posted mr-ws
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了quota磁盘配额相关的知识,希望对你有一定的参考价值。
quota磁盘配额(user)
1.开启配额功能:
[[email protected] /]# mount -o usrquota /dev/sda5 /mnt/
2.设置用户配额:
[[email protected] /]# edquota -u robin /mnt
3.查询配额的使用情况
[[email protected] /]# repquota -u /mnt
4.启动配额:
[[email protected] mnt]# quotaon /mnt/
1.开启配额功能:
[[email protected] /]# mount -o usrquota /dev/sda5 /mnt/
2.设置用户配额:
[[email protected] /]# edquota -u robin /mnt
3.查询配额的使用情况
[[email protected] /]# repquota -u /mnt
4.启动配额:
[[email protected] 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/abc1..25.txt
touch /mnt/abc1..25.txt
group配额:
group upup
useradd -g upup king
useradd -g upup zorro
1.开启组配额
[[email protected] /]# mount -o grpquota /dev/sda5 /mnt/
2.配置组配额
[[email protected] /]# 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
[[email protected] /]# mount -o grpquota /dev/sda5 /mnt/
2.配置组配额
[[email protected] /]# 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
测试:
[[email protected] ~]# su - king
[[email protected] mnt]$ dd if=/dev/zero of=/mnt/data1 bs=80M count=1
[[email protected] ~]# su - king
[[email protected] mnt]$ dd if=/dev/zero of=/mnt/data1 bs=80M count=1
[[email protected] ~]# su - zorro
[[email protected] ~]$ dd if=/dev/zero of=/mnt/data2 bs=80M count=1
[[email protected] ~]$ dd if=/dev/zero of=/mnt/data2 bs=80M count=1
测试配额空间为共用
设置宽限时间
[[email protected] ~]# edquota -t
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/sda5 30seconds 7days
测试:
1.开启配额功能:
[[email protected] /]# mount -o usrquota /dev/sda5 /mnt/
2.设置用户配额:
[[email protected] /]# edquota -u robin /mnt
Disk quotas for user robin (uid 1000):
Filesystem blocks soft hard inodes soft hard
/dev/sda5 0 50M 100M 0 10 20
3.查询配额的使用情况
[[email protected] /]# repquota -u /mnt
4.启动配额:
[[email protected] mnt]# quotaon /mnt/
以上是关于quota磁盘配额的主要内容,如果未能解决你的问题,请参考以下文章