Add to Favourites Add to Favourites    Print this Article Print this Article

Setting up quotas on an XFS partition

The xfs file system is different than the previous ext3/ext4 file systems.
This guide will be closely related to the standard quota setup guide, except that xfs may have a few extra steps that require more manual intervention.

If you need quotas setup on the /home partition, then the guide should be very similar to the standard quota setup guide.   However, if you need quotas setup on /, where / uses use an XFS partition (/home is only a directory under /), then extra steps are required.

As well, we replace the grpquota with pquota (project quotas), which will allow DA to setup directoy quotas, for things like enforcement of per-domain disk quotas.

To confirm what setup you have, run the df commmand, eg:

[root@es7-64 ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   14G  2.3G   12G  17% /
devtmpfs                 915M     0  915M   0% /dev
tmpfs                    921M   24K  921M   1% /dev/shm
tmpfs                    921M  8.5M  912M   1% /run
tmpfs                    921M     0  921M   0% /sys/fs/cgroup
/dev/sda1                497M  125M  372M  26% /boot
[root@es7-64 ~]#

as you can see, /home is not a partition, so it falls under the / partition, so we must ensure that quotas are functional on the / partition.

0) Next confirm that / is actually using the xfs file system:

[root@es7-64 ~]# mount | grep ' / '
/dev/mapper/centos-root on / type xfs (rw,relatime,attr2,inode64,noquota)
[root@es7-64 ~]#

if you see the "noquota" option, then you need to go to step 1, below.
If you don't see noquota, then you should be able to follow the standard quota setup guide, but adding uquota,pquota to the /etc/fsab, after the default option.

If you see "noquota" in the xfs mount options for the / partition

1) Because "noquota" is a default kernel mounting option, we must change it in the kernel boot options.
Edit the file:


2) Find the line with the variable "GRUB_CMDLINE_LINUX", that might look like this (it may not look exactly the same, don't worry):

GRUB_CMDLINE_LINUX=" vconsole.font=latarcyrheb-sun16 crashkernel=auto  vconsole.keymap=us rhgb quiet"

3) We're going to put a "rootflags=" variable at the end of the line
- And add uquota,pquota as the values
It might look something like this:

GRUB_CMDLINE_LINUX=" vconsole.font=latarcyrheb-sun16 crashkernel=auto  vconsole.keymap=us rhgb quiet rootflags=uquota,pquota"

4) Now, based on that setup, we'll backup, then create a new grub.cfg file:

cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.orig
grub2-mkconfig -o /boot/grub2/grub.cfg

The path on some OSs has been changed to


5) Lastly, we must reboot the box in order for the kernel to see these new options


6) We keep our fingers crossed that the box comes back, and login again.  Go back to step 0) to check the mounting options to ensure that "noquota" is gone, eg:

[root@es7-64 ~]# mount | grep ' / '
/dev/mapper/centos-root on / type xfs (rw,relatime,attr2,inode64,usrquota,prjquota)
[root@es7-64 ~]#

Once it's gone, we want to see usrquota,prjquota(or uquota,pquota, they're the same thing).
If you don't see, them, then add them to the / partition with the standard quota setup guide.

7) Ensure that DirectAdmin has xfs quotas enabled in the directadmin.conf:

cd /usr/local/directadmin
./directadmin c | grep use_xfs_quota

8) If there are already Users created in DA, then you'll also want to reset their quota limits:

echo "action=rewrite&value=quota" >> /usr/local/directadmin/data/task.queue

to ensure their upper disk usage limits are enforced.

CloudLinux / DigitalOcean

Report that /etc/default/grub may be ignored for these setups.
The file /etc/rc.d/init.d/kexec applies instead (untested):

where you'd add the rootflags=uquota,pquota to the end of the line that start with kexec -l

Was this answer helpful?

Also Read