Operations 14 min read

Implementing Linux Disk Quota on XFS: User, Group, and Project Based Limits

This guide explains how to configure and manage Linux disk quotas on XFS file systems, covering prerequisites, quota activation options, user/group/project quota modes, command‑line procedures, testing scenarios, and common operational commands for administrators.

360 Tech Engineering
360 Tech Engineering
360 Tech Engineering
Implementing Linux Disk Quota on XFS: User, Group, and Project Based Limits

Background : Linux Disk Quota limits filesystem resource usage per user, group, or directory, preventing a single entity from exhausting disk space. The article focuses on applying quota on XFS.

Prerequisites :

Kernel must support quota; XFS has built‑in quota support.

Quota works for ordinary users (root is unrestricted).

Disable SELinux for testing.

Ext filesystems limit only at mount‑point level; XFS can limit per directory.

Quota modes :

usrquota : per‑user limits (root excluded).

grpquota : per‑group limits.

prjquota : per‑directory (project) limits, supported by XFS.

Typical workflow :

Disable SELinux.

Edit /etc/fstab to add quota options (e.g., usrquota,grpquota,prjquota ).

Remount the target filesystem.

Verify quota activation with xfs_quota -x -c "state" .

Set limits using xfs_quota commands.

Validate the limits and monitor usage.

xfs_quota command overview :

Common parameters are shown in the following table (image omitted).

Grace time provides a soft‑limit window; when usage exceeds the soft limit, a timer starts, after which writes are blocked.

Step 1 – User‑based quota :

# vi /etc/fstab
# add: /dev/sdb1 /data xfs defaults,nodiratime,noatime,usrquota 1 2
# umount /data
# mount -a
# mount | grep data
/dev/sdb1 on /data type xfs (rw,noatime,nodiratime,attr2,inode64,logbufs=8,logbsize=32k,usrquota)
# xfs_quota -x -c "state"
User quota state on /data (/dev/sdb1)    Accounting: ON
Enforcement: ON

Set a quota for the MySQL user (soft 10 M, hard 20 M) and a 1‑minute grace time:

# xfs_quota -x -c "limit -u bsoft=10M bhard=20M mysql" /data
# xfs_quota -x -c "timer -u -b 1minutes" /data

Test scenarios demonstrate write failures when exceeding hard or soft limits.

Step 2 – Directory (project) quota :

# vi /etc/fstab
/dev/sdb1 /data xfs defaults,nodiratime,noatime,prjquota 1 2
# umount /data
# mount -a
# xfs_quota -x -c "state"
Project quota state on /data (/dev/sdb1)    Accounting: ON
Enforcement: ON

Create project‑directory mapping:

# echo "1:/data/mysqldata" >> /etc/projects
# echo "mysqldata:1" >> /etc/projid
# xfs_quota -x -c "project -s mysqldata" /data

Assign a hard limit of 10 M (soft 6 M) to the project:

# xfs_quota -x -c "limit -p bsoft=6M bhard=10M mysqldata" /data

Testing shows writes stop at the hard limit.

Common operational commands :

# xfs_quota -x -c "disable -up" /data   # temporarily disable
# xfs_quota -x -c "enable -p" /data    # re‑enable
# xfs_quota -x -c "off -up" /data      # permanently disable (requires remount)

Adjusting grace time:

# xfs_quota -x -c "timer -u -b 14days" /data   # user
# xfs_quota -x -c "timer -g -b 14days" /data   # group
# xfs_quota -x -c "timer -p -b 14days" /data   # project

Rebuilding a quota‑controlled directory removes its quota; re‑initialize the project with xfs_quota -x -c "project -s mysqldata" to restore limits.

Summary : The article provides a practical, step‑by‑step procedure for deploying XFS‑based disk quotas, covering user, group, and project limits, testing, common maintenance commands, and how to adjust limits and grace periods.

operationsLinuxSystem AdministrationDisk QuotaQuota ManagementXFS
360 Tech Engineering
Written by

360 Tech Engineering

Official tech channel of 360, building the most professional technology aggregation platform for the brand.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.