3.3. XFS Quota Management
The XFS quota subsystem manages limits on disk space (blocks) and file (inode) usage. XFS quotas control or report on usage of these items on a user, group, or directory or project level. Also, note that while user, group, and directory or project quotas are enabled independently, group and project quotas are mutually exclusive.
When managing on a per-directory or per-project basis, XFS manages the disk usage of directory hierarchies associated with a specific project. In doing so, XFS recognizes cross-organizational "group" boundaries between projects. This provides a level of control that is broader than what is available when managing quotas for users or groups.
XFS quotas are enabled at mount time, with specific mount options. Each mount option can also be specified as
noenforce; this allows usage reporting without enforcing any limits. Valid quota mount options are:
uqnoenforce: User quotas
gqnoenforce: Group quotas
pqnoenforce: Project quota
Once quotas are enabled, the
xfs_quotatool can be used to set limits and report on disk usage. By default,
xfs_quotais run interactively, and in basic mode. Basic mode subcommands simply report usage, and are available to all users. Basic
- Show usage and limits for the given
- Shows free and used counts for blocks and inodes.
xfs_quotaalso has an expert mode. The subcommands of this mode allow actual configuration of limits, and are available only to users with elevated privileges. To use expert mode subcommands interactively, use the following command:
Expert mode subcommands include:
- Reports quota information for a specific file system.
- Modify quota limits.
For a complete list of subcommands for either basic or expert mode, use the subcommand
All subcommands can also be run directly from a command line using the
-xfor expert subcommands.
Example 3.2. Display a Sample Quota Report
For example, to display a sample quota report for
/dev/blockdevice), use the command
xfs_quota -x -c 'report -h' /home. This displays output similar to the following:
User quota on /home (/dev/blockdevice) Blocks User ID Used Soft Hard Warn/Grace ---------- --------------------------------- root 0 0 0 00 [------] testuser 103.4G 0 0 00 [------] ...
To set a soft and hard inode count limit of 500 and 700 respectively for user
john, whose home directory is
/home/john, use the following command:
xfs_quota -x -c 'limit isoft=500 ihard=700 john' /home/
In this case, pass mount_point which is the mounted xfs file system.
By default, the
limitsubcommand recognizes targets as users. When configuring the limits for a group, use the
-goption (as in the previous example). Similarly, use
Soft and hard block limits can also be configured using
Example 3.3. Set a Soft and Hard Block Limit
For example, to set a soft and hard block limit of 1000m and 1200m, respectively, to group
/target/pathfile system, use the following command:
xfs_quota -x -c 'limit -g bsoft=1000m bhard=1200m accounting' /target/path
bhardcount by the byte.
While real-time blocks (
rtbsoft) are described in
man xfs_quotaas valid units when setting quotas, the real-time sub-volume is not enabled in this release. As such, the
rtbsoftoptions are not applicable.
Setting Project Limits
With XFS file system, you can set quotas on individual directory hierarchies in the file system that are known as managed trees. Each managed tree is uniquely identified by a project ID and an optional project name.
- Add the project-controlled directories to
/etc/projects. For example, the following adds the
/var/logpath with a unique ID of 11 to
/etc/projects. Your project ID can be any numerical value mapped to your project.
#echo 11:/var/log >> /etc/projects
- Add project names to
/etc/projidto map project IDs to project names. For example, the following associates a project called Logs with the project ID of 11 as defined in the previous step.
#echo Logs:11 >> /etc/projid
- Initialize the project directory. For example, the following initializes the project directory
xfs_quota -x -c 'project -s logfiles' /var
- Configure quotas for projects with initialized directories:
xfs_quota -x -c 'limit -p bhard=lg logfiles' /var
Generic quota configuration tools (
edquotafor example) may also be used to manipulate XFS quotas. However, these tools cannot be used with XFS project quotas.
Red Hat recommends the use of
xfs_quotaover all other available tools.
For more information about setting XFS quotas, see
man projid(5), and