20.23 Setting Quotas on an XFS File System

The following table shows the mount options that you can specify to enable quotas on an XFS file system:

Mount OptionDescription

gqnoenforce

Enable group quotas. Report usage, but do not enforce usage limits.

gquota

Enable group quotas and enforce usage limits.

pqnoenforce

Enable project quotas. Report usage, but do not enforce usage limits.

pquota

Enable project quotas and enforce usage limits.

uqnoenforce

Enable user quotas. Report usage, but do not enforce usage limits.

uquota

Enable user quotas and enforce usage limits.

To show the block usage limits and the current usage in the myxfs file system for all users, use the xfs_quota command:

# xfs_quota -x -c 'report -h' /myxfs
User quota on /myxfs (/dev/vg0/lv0)
                        Blocks              
User ID      Used   Soft   Hard Warn/Grace   
---------- --------------------------------- 
root            0      0      0  00 [------]
guest           0   200M   250M  00 [------]

The following forms of the command display the free and used counts for blocks and inodes respectively in the manner of the df -h command:

# xfs_quota -c 'df -h' /myxfs
Filesystem     Size   Used  Avail Use% Pathname
/dev/vg0/lv0 200.0G  32.2M  20.0G   1% /myxfs

# xfs_quota -c 'df -ih' /myxfs
Filesystem   Inodes   Used   Free Use% Pathname
/dev/vg0/lv0  21.0m      4  21.0m   1% /myxfs

If you specify the -x option to enter expert mode, you can use subcommands such as limit to set soft and hard limits for block and inode usage by an individual user, for example:

# xfs_quota -x -c 'limit bsoft=200m bhard=250m isoft=200 ihard=250 guest' /myxfs 

Of course, this command requires that you mounted the file system with user quotas enabled.

To set limits for a group on an XFS file system that you have mounted with group quotas enabled, specify the -g option to limit, for example:

# xfs_quota -x -c 'limit -g bsoft=5g bhard=6g devgrp' /myxfs

For more information, see the xfs_quota(8) manual page.