Introduction
How to enabled XFS quotas on a CentOS 7.x server.
Procedure
You've noticed WHM shows quotas disabled and XFS is being used as the filesystem and you want to enable quotas the following may be useful.
First, confirm that XFS quotas are not enabled. Notice noquota is shown below.
[15:01:31 cp1 root@93969605 /etc]cPs# mount |grep xfs
/dev/vda1 on / type xfs (rw,relatime,attr2,inode64,noquota)
[15:01:36 cp1 root@93969605 /etc]cPs#
Also, if you run the following to get XFS quota status you will get no results
xfs_quota -x -c state
Next, check that /etc/fstab has the filesystem setting enabled
[15:01:36 cp1 root/etc]cPs# grep xfs /etc/fstab
UUID=de86ba8a-914b-4104-9fd8-f9de800452ea / xfs defaults,uquota 0 0
[15:02:09 cp1 root/etc]cPs#
Unlike ext filesystem configurations XFS needs to be configured with kernel options during boot up. This is done by modifying
/etc/sysconfig/grub
or on EFI enabled systems
/boot/efi/EFI/centos/grub.cfg
and changing the "GRUB_CMDLINE_LINUX=" line with "rootflags=uquota" added like this as an example
GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200 earlyprintk=ttyS0,115200 consoleblank=0 crashkernel=no nosplash nomodeset rootflags=uquota"
Afterward, make a copy of the grub configuration files. These can be either /boot/grub2/grub.cfg or /boot/efi/EFI/centos/grub.cfg so it's best to run both these commands. One of them may say file not found.
cp -ax /boot/grub2/grub.cfg /boot/grub2/grub.cfg.orig-$(date +%s)
cp -ax /boot/efi/EFI/centos/grub.cfg /boot/efi/EFI/centos/grub.cfg.$(date +%s)
cp -ax /boot/efi/EFI/almalinux/grub.cfg /boot/efi/EFI/almalinux/grub.cfg.$(date +%s)
The last change needed is rebuilding the grub configuration file used during the server boot procedure. This is done by running:
If /boot/grub2/grub.cfg exists:
grub2-mkconfig -o /boot/grub2/grub.cfg
or, if /boot/efi/EFI/centos/grub.cfg exists:
grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
or, if /boot/efi/EFI/centos/grub.cfg exists:
grub2-mkconfig -o /boot/efi/EFI/almalinux/grub.cfg
and then the server can be rebooted.
Afterward, quotas should now be enabled. You may need to run the following to see the quotas set for cPanel users.
/usr/local/cpanel/scripts/resetquotas
If you have attempted to enable quotas after following this guide with no success, then it likely means you have a system that utilizes UEFI firmware and you will want to proceed to this article: