Product SiteDocumentation Site

5.2.2. Exercise 2 - Quota Controls (user/group)

  1. un “xfs_quota -x” as root and set quota controls on an ordinary user.
    # sudo /usr/sbin/xfs_quota -x /mnt/xfstest
    xfs_quota> limit bsoft=10m bhard=20m youruser
  2. Investigate how the limit command has affected your user.
    # /usr/sbin/xfs_quota -c 'quota -v'
  3. Exceed the soft quota. Note that while your (soft) quota has been exceeded you can still write files.
    # cd /mnt/xfstest
    # dd if=/dev/urandom of=./testfile1 bs=1k count=15000
    # /usr/sbin/xfs_quota -c 'quota' /mnt/xfstest
    # ls > testfile2
  4. Exceeding hard Quota
    # rm testfile1 testfile2
    # dd if=/dev/urandom of=./testfile1 bs=1k count=30000
    dd: writing `./testfile': Disk quota exceeded
    20417+0 records in
    20416+0 records out
    20905984 bytes (21 MB) copied, 4.20713 seconds, 5.0 MB/s
  5. Run the quota command and examine the output.
    # /usr/sbin/xfs_quota -c quota
    Disk quotas for User youruser (500)
    Filesystem              Blocks      Quota      Limit  Warn/Time      Mounted on
    /dev/hdb1                20416      10240      20480   00  [6 days] /mnt/xfstest
  6. Run the generic repquota command to compare the behavior.
    # /usr/sbin/repquota /mnt/xfstest
    *** Report for user quotas on device /dev/hdb1
    Block grace time: 7days; Inode grace time: 7days
                            Block limits                File limits
    User            used    soft    hard  grace    used  soft  hard  grace
    youruser   +-   20416   10240   20480  6days       1     0     0
  7. Remove the test files created above and investigate the affects of quotas on holey files. Holey files can be created with dd
    # dd if=/dev/urandom of=./testfile bs=1k count=1 seek=2000000
  8. Compare the outputs of
    # ls -hl
    # du -h *
    # /usr/sbin/xfs_quota -c quota
  9. Experiment with inode quotas.
    xfs_quota> limit isoft=5 ihard=10 youruser
  10. Create files to exceed your soft and hard limits. Note that the xfs_quota quota command takes a -i option to report on inodes.
  11. Experiment with group quotas. You will need to remount the filesystem after adding the gquota option to the fstab. xfs_quota commands use -g to indicate they are working with groups.