Question
How do you enable quotas on XFS filesystems?
Answer
XFS File systems do not always come configured with support for file system quotas. This article can help you prepare your file systems to allow quotas to be used and accurately record your cPanel users' disk space usage.
Note: cPanel does not directly support changing kernel options and file system settings. These steps are provided as a guide, but if you require more detailed assistance, we recommend you reach out to a qualified System Administrator.
This guide uses paths that are dependent on your operating system. For simplicity, we will list examples using AlmaLinux, but if you are using CentOS or RockyLinux, your grub paths for EFI-enabled servers will look like the examples here:
/boot/efi/EFI/almalinux/grub.cfg/boot/efi/EFI/centos/grub.cfg/boot/efi/EFI/rocky/grub.cfg
- Log in to the server via SSH or WHM's Terminal as the
rootuser -
Confirm that XFS quotas are not enabled. Notice "noquota" is shown below.
# mount | grep xfs
/dev/sda1 on / type xfs (rw,relatime,attr2,inode64,noquota)
[15:01:36 cp1 root /etc]cPs#Also, if you run the following to get XFS quota status, you will get no results:
# xfs_quota -x -c state
-
Check that
/etc/fstabhas the filesystem setting enabled. We are looking for the "uquota" setting to be listed here:# grep xfs /etc/fstab
UUID=[UUID_VALUE] / xfs defaults,uquota 0 0 \ -
The XFS file system requires the quota settings to be enabled at boot time in the kernel options. This is done by modifying one of the following two files:
/etc/sysconfig/grub#for most systems/boot/efi/EFI/almalinux/grub.cfg#for EFI-enabled systemsAdd "rootflags=uquota" to the end of the "GRUB_CMDLINE_LINUX=" line, similar to the following example:
CONFIG_TEXT: GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200 earlyprintk=ttyS0,115200 consoleblank=0 crashkernel=no nosplash nomodeset rootflags=uquota"
-
Make a copy of the grub configuration files. The following commands will make backups of any grub configuration files on your system. Some may return a file not found error, but this can be ignored, as not all paths exist on all systems:
# cp -ax /boot/grub2/grub.cfg /boot/grub2/grub.cfg.orig-$(date +%s)
# cp -ax /boot/efi/EFI/almalinux/grub.cfg /boot/efi/EFI/almalinux/grub.cfg.$(date +%s)
# cp -ax /boot/efi/EFI/almalinux/grub.cfg /boot/efi/EFI/almalinux/grub.cfg.$(date +%s)
-
Rebuild the grub configuration file used during the server boot procedure. Choose the most appropriate from the following:
If
/boot/grub2/grub.cfgexists:# grub2-mkconfig -o /boot/grub2/grub.cfg
If
/boot/efi/EFI/almalinux/grub.cfgexists:# grub2-mkconfig -o /boot/efi/EFI/almalinux/grub.cfg
or, if
/boot/efi/EFI/almalinux/grub.cfgexists:# grub2-mkconfig -o /boot/efi/EFI/almalinux/grub.cfg
-
Reboot the server, and quotas should now be enabled. You can run the same check from Step 1 and see "uquota" listed instead of "noquota":
# mount |grep xfs
/dev/sda1 on / type xfs (rw,relatime,attr2,inode64,uquota) -
Run the following script to reset quotas for your cPanel users:
# /scripts/resetquotas
If quotas are still not working after following this guide, it likely means you have a system that utilizes UEFI firmware, and you will want to proceed to this article:
Comments
0 comments
Article is closed for comments.