CentosControl PanelCWPLinuxVesta CP

How to Enable XFS Disk quota in CentOS and CWP panel

In this tutorial we’ll configure XFS disk quota in centos and CWP control web panel. In server xfs quota setup will not work because of Kernel parameter is set to “noquota” we’ll bypass and configure it with the help of below tutorial which is easy to follow and configure.

The XFS quota subsystem manages limits on disk space (blocks) and file (inode) usage. XFS quotas control or report on usage of these items on a user, group, or directory or project level.

Install quota packages :

yum -y install quota*

For EL8/RHEL 8/CentOS 8 only :

dnf --enablerepo=Devel install quota*

Now we’ll check the disk type and double check if it is XFS file system :

mount | grep ' / '

output :

/dev/mapper/centos-root on / type xfs (rw,relatime,attr2,inode64,noquota)

If you’ve separate disk/partition for /home :

mount | grep ' /home '

output

/dev/mapper/centos-root-home on /home type xfs (rw,relatime,attr2,inode64,noquota)

**** if you see “xfs and “noquota” in output proceed with this steps :

Edit grub and add this kernel grub parameter rootflags=uquota,pquota :

rootflags=uquota,pquota under GRUB_CMDLINE_LINUX option at last and under quotes

chattr -i /etc/default/grub
nano /etc/default/grub

Example :

GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet rootflags=uquota,pquota"
GRUB_DISABLE_RECOVERY="true"

Now backup current grub config and rebuild grub :

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

On some OS boot path has been changed for EFI [EFI BOOT] :
/boot/efi/EFI/centos/grub.cfg

Check if you’ve EFI grub support is there :

If this command reports there is no such file you can ignore this step

ls /boot/efi/EFI/centos/grub.cfg

If file is present then you also need to rebuild EFI grub :

cp /boot/efi/EFI/centos/grub.cfg /boot/efi/EFI/centos/grub.cfg.org
grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg

Now edit fstab :

edit file: /etc/fstab and add usrquota,grpquota example:
/dev/mapper/centos_root / xfs defaults,usrquota,grpquota 0 0

before example :

/dev/mapper/centos-root / xfs defaults 0 0

after example :

/dev/mapper/centos-root / xfs defaults,usrquota,grpquota 0 0

Then reboot you Server :

reboot

Then check if the quota is enabled or not “noquota” should be gone now and replaced with “usrquota,grpquota”  :

mount | grep ' / '
/dev/mapper/centos-root on / type xfs (rw,relatime,attr2,inode64,usrquota,grpquota)

For CWP only :

Activate quota as XFS for /
in CWP.admin go to Left Menu -> Server Settings –> Disk Quota , and set
Quota Partition: /
Quota Type: xfs

If you’ve separate disk/partition for /home :

edit file: /etc/fstab and add usrquota,grpquota example:
/dev/mapper/centos-root-home /home xfs defaults,usrquota,grpquota 0 0

before example

/dev/mapper/centos-root-home /home xfs defaults 0 0

after example

/dev/mapper/centos-root-home /home xfs defaults,usrquota,grpquota 0 0

Then reboot you Server :

reboot

Then check if the quota is enabled or not “noquota” should be gone now and replaced with “usrquota,prjquota”  :

For /home

mount | grep ' /home '
/dev/mapper/centos-root-home on /home type xfs (rw,relatime,attr2,inode64,usrquota,grpquota)

For CWP only :

Activate quota as XFS for /home
in CWP.admin go to Left Menu -> Server Settings –> Disk Quota , and set
Quota Partition: /home
Quota Type: xfs

Done you’ve enabled xfs quota update the packages for the users by selecting update quota for users option and check the disk quota.

CWP only :

After enabling the quota run this command to update the user quota in CWP :

/scripts/cwp_api account update_diskquota_all

Sandeep B.

I'm a system admin and php developer and currently working as System Admin In CWP Control panel, expertise in Linux and Windows administration RHEL certified admin.

Related Articles

23 Comments

  1. Thanks for sharing this.
    I had to modify this entry to make it function:
    rootflags=uquota,pquota under GRUB_CMDLINE_LINUX
    using this:
    rootflags=usrquota,grpquota under GRUB_CMDLINE_LINUX

  2. It didn’t work for me… after doing the grub and efi steps, I restarted. But the command shows:

    mount | grep ‘ / ‘
    /dev/md3 on / type xfs (rw,relatime,attr2,inode64,noquota)

    What can happen? It’s cents 8.

    Greetings!

      1. No, look what’s in the file:

        /dev/md3 / xfs rw,relatime,attr2,inode64,usrquota,grpquota 0 0
        UUID=”**” /boot xfs defaults 0 0
        UUID=”**” swap swap defaults 0 0
        UUID=”**” swap swap defaults 0 0
        LABEL=EFI_SYSPART /boot/efi vfat defaults 0 0

          1. change from

            /dev/md3 / xfs rw,relatime,attr2,inode64,usrquota,grpquota 0 0

            to
            /dev/md3 / xfs defaults,usrquota,grpquota 0 0

            reboot then check.

            if not you can contact via forum with server detail.

          2. i checked it

            [root@servidor system]# cat /proc/mounts | grep /dev/md3
            /dev/md3 / xfs rw,relatime,attr2,inode64,noquota 0 0

            [root@servidor system]# cat /etc/fstab | grep md3
            /dev/md3 / xfs defaults,usrquota,grpquota 0 0

            seems your server OS is hard coded somewhere to ignore fstab lol 😀

Leave a Reply

Your email address will not be published.

Back to top button