Managing Quotas on an XFS File System

Use the xfs_quota tool to manage quotas on an XFS file system. This tool is catered to quota implementation in XFS. While other quota tools, such as edquota might enable you to edit XFS quotas, xfs_quota is preferred.

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

Displaying Block Usage Information

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

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 in the manner of the df -h command:

sudo xfs_quota -c 'df -h' /myxfs
Filesystem     Size   Used  Avail Use% Pathname
/dev/vg0/lv0 200.0G  32.2M  20.0G   1% /myxfs
sudo xfs_quota -c 'df -ih' /myxfs
Filesystem   Inodes   Used   Free Use% Pathname
/dev/vg0/lv0  21.0m      4  21.0m   1% /myxfs

Setting Quota Limits

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:

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

Note that this command requires that you have 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:

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

Setting Project Quota Limits

The instructions that follow here assume that you have already mounted the file system using the pquota option and have created a project ID in /etc/projects. See Setting Project Quotas.

  1. Use the project subcommand of xfs_quota to define a managed tree in the XFS file system for the project.

    sudo xfs_quota -x -c ’project -s project_namemountpoint

    For example, you would define a managed tree in the /myxfs file system for the project testproj, which corresponds to the directory hierarchy /myxfs/testdir, as follows:

    sudo xfs_quota -x -c ’project -s testproj’ /myxfs
  2. Use the limit subcommand to set limits on the disk usage of the project.

    sudo xfs_quota -x -c ’limit -p arguments project_namemountpoint

    For example, to set a hard limit of 10 GB of disk space for the project testproj, you would use the following command:

    sudo xfs_quota -x -c ’limit -p bhard=10g testproj’ /myxfs

For more information, see the projects(5), projid(5), and xfs_quota(8) manual pages.