0.实验前的环境检查与配置
[student@workstation ~]$ lab quotas setup
1.配置定额
mount | grep graphics查看已经挂载的目录。umount /mnt/graphics取消挂载。gluster volume quota graphics enable启动定额控制。gluster volume quota graphics limit-usage /raw 1GB 50%设置子目录的硬件限制与软件限制。gluster volume quota graphics list显示定额列表。
[root@workstation ~]# mount | grep graphics
servera:/graphics on /mnt/graphics type fuse.glusterfs (rw,relatime,user_id=0,group_id=0,allow_other,max_read=131072)
[root@workstation ~]# umount /mnt/graphics
[root@servera ~]# gluster volume quota graphics enable
volume quota : success
[root@servera ~]# gluster volume quota graphics limit-usage /raw 1GB 50%
volume quota : success
[root@servera ~]# gluster volume quota graphics list
Path Hard-limit Soft-limit Used Available Soft-limit exceeded? Hard-limit exceeded?
-------------------------------------------------------------------------------------------------------------------------------
/raw 1.0GB 50%(512.0MB) 0Bytes 1.0GB No No
2.配置超时
gluster volume quota graphics soft-timeout 5s设置软件超时。gluster volume quota graphics hard-timeout 1s设置硬件超时。
[root@servera ~]# gluster volume quota graphics soft-timeout 5s
volume quota : success
[root@servera ~]# gluster volume quota graphics hard-timeout 1s
volume quota : success
3.配置选项
gluster volume set help | grep quota-deem-statfs -A2查看开关的意义(控制文件系统大小限制的功能)。gluster volume set graphics quota-deem-statfs on把功能开启。
[root@servera ~]# gluster volume set help | grep quota-deem-statfs -A2
Option: features.quota-deem-statfs
Default Value: off
Description: If set to on, it takes quota limits intoconsideration while estimating fs size. (df command) (Default is off).
[root@servera ~]# gluster volume set graphics quota-deem-statfs on
volume set: success
4.测试限制功能
mount /mnt/graphics挂载目录。mount | grep graphics确认已经挂载。dd if=/dev/zero of=/mnt/graphics/raw/testfile bs=1M测试写入(直到超过限额后会报提醒)。ls -lh /mnt/graphics/raw/testfile监测写入过程。
[root@workstation ~]# mount /mnt/graphics
[root@workstation ~]# mount | grep graphics
servera:/graphics on /mnt/graphics type fuse.glusterfs (rw,relatime,user_id=0,group_id=0,allow_other,max_read=131072)
[root@workstation ~]# dd if=/dev/zero of=/mnt/graphics/raw/testfile bs=1M
dd: error writing ‘/mnt/graphics/raw/testfile’: Disk quota exceeded
dd: closing output file ‘/mnt/graphics/raw/testfile’: Disk quota exceeded
[root@workstation ~]# ls -lh /mnt/graphics/raw/testfile
-rw-r--r--. 1 root root 253M Jan 26 23:20 /mnt/graphics/raw/testfile
[root@workstation ~]# ls -lh /mnt/graphics/raw/testfile
-rw-r--r--. 1 root root 768M Jan 26 23:22 /mnt/graphics/raw/testfile
[root@workstation ~]# ls -lh /mnt/graphics/raw/testfile
-rw-r--r--. 1 root root 849M Jan 26 23:22 /mnt/graphics/raw/testfile
[root@workstation ~]# ls -lh /mnt/graphics/raw/testfile
-rw-r--r--. 1 root root 1014M Jan 26 23:23 /mnt/graphics/raw/testfile
[root@workstation ~]# rm /mnt/graphics/raw/testfile
rm: remove regular file ‘/mnt/graphics/raw/testfile’? y
5.任务测评
lab quotas grade进行测评。测评包括:挂载目录,挂载与取消挂载,选项功能,定额是否启动,定额限制,软件超时,硬件超时等功能。
[student@workstation ~]$ lab quotas grade
Grading the student's work:
· Testing if all hosts are reachable.......................... SUCCESS
· Checking for current mount on /mnt/graphics on workstation.. PASS
· Checking if /mnt/graphics on workstation is in use.......... PASS
· Unmounting /mnt/graphics.................................... PASS
· Mounting /mnt/graphics...................................... PASS
· Checking for current mount on /mnt/graphics on workstation.. PASS
· Checking mount options for /mnt/graphics in /etc/fstab...... PASS
· Testing if quotas are enabled for graphics.................. PASS
· Testing quota limits........................................ PASS
· Checking for quota reporting in 'df'........................ PASS
· Checking soft timeouts...................................... PASS
· Checking hard timeouts...................................... PASS
Overall lab grade.............................................. PASS