存储quota详解
存储Quota详解
针对quota限制的项目主要有三项:
(一) uquota/usrquota/quota: 针对使用者账号的设定
(二)gquota/grpquota:针对群组的设定
(三)pquota/prjquota:针对单一目录的设定,但是不可与grpquota 同时存在
用户和组的限制:usrquota,grpquota
#######################################
用户和目录的限制:usrquota、prjquota
1,先将grpguota的参数取消,然后加入prjquota, 重新挂载/ifs/data/;并确认开启prjquota。 |
#umout /ifs/data #vim /etc/fstab (重启机器) /dev/vdb /ifs/data xfs defaults,usrquota,prjquota 0 0 #mount -a # # xfs_quota -x -c "state" User quota state on /ifs/data (/dev/vdb) Accounting: ON Enforcement: ON Inode: #69 (3 blocks, 3 extents) Group quota state on /ifs/data (/dev/vdb) Accounting: OFF ç已取消 Enforcement: OFF Inode: #70 (1 blocks, 1 extents) Project quota state on /ifs/data (/dev/vdb) Accounting: ON ç已开启 Enforcement: ON Inode: #70 (1 blocks, 1 extents) Blocks grace time: [900 days] Inodes grace time: [900 days] Realtime Blocks grace time: [--------] # xfs_quota -x -c "print" /ifs/data/ Filesystem Pathname /ifs/data /dev/vdb (uquota, pquota) |
2,规范目录,项目名称(project)与项目ID |
|
(1)指定项目标识符与目录对应在/etc/projects
|
# echo "21:/ifs/data/BC_COM_01" >> /etc/projects # echo "22:/ifs/data/BC_COM_02" >> /etc/projects
|
(2)规范专案名称与标识符的对应在/etc/projid
|
# echo "myquotaproject21:21" >> /etc/projid # echo "myquotaproject22:22" >> /etc/projid
|
(3)初始化专案名称
|
# xfs_quota -x -c "project -s myquotaproject21" # xfs_quota -x -c "project -s myquotaproject22"
|
(4)完整查看到相应的各项文件系统与project目录对应 |
# xfs_quota -x -c "print" /ifs/data/ Filesystem Pathname /ifs/data /dev/vdb (uquota, pquota) /ifs/data/BC_COM_01 /dev/vdb (project 21, myquotaproject21) /ifs/data/BC_COM_02 /dev/vdb (project 22, myquotaproject22)
|
(5)查看是否有抓到项目名称
|
# xfs_quota -x -c "report -pbih" /ifs/data/ Project quota on /ifs/data (/dev/vdb) Blocks Inodes Project ID Used Soft Hard Warn/Grace Used Soft Hard Warn/Grace ---------- --------------------------------- --------------------------------- #0 0 0 0 00 [------] 4 0 0 00 [------] myquotaproject21 0 0 0 00 [------] 1 0 0 00 [------] myquotaproject22 0 0 0 00 [------] 1 0 0 00 [------] |
(6)设定project,设定的方式使用limit 的bsoft/bhard 。 |
# xfs_quota -x -c "limit -p bsoft=9G bhard=10G myquotaproject21" /ifs/data/ # xfs_quota -x -c "limit -p bsoft=19G bhard=20G myquotaproject22" /ifs/data/ |
(7)查看 |
# xfs_quota -x -c "report -pbih" /ifs/data/ Project quota on /ifs/data (/dev/vdb) Blocks Inodes Project ID Used Soft Hard Warn/Grace Used Soft Hard Warn/Grace ---------- --------------------------------- --------------------------------- #0 0 0 0 00 [------] 4 0 0 00 [------] myquotaproject21 0 9G 10G 00 [------] 1 0 0 00 [------] myquotaproject22 0 19G 20G 00 [------] 1 0 0 00 [------] |
(8)修改配置文件 |
#vim /etc/exports 创建的目录都写进去, |
(9)写入数据 |
# dd if=/dev/zero of=/ifs1/BC_COM_P09/123.img bs=10M count=90 |
关闭project |
待补充 |
客户端显示mount目录 |
showmount -e X.X.X.X |
################################################################################
1,如果需要使软限制也起作用的话,还需要对用户的软限制设定宽限期,缺省的软限制的宽限期是无穷
#edquota -t
#xfs_quota -x -c "state"
#############################