Jump to content

How to Enable XFS Disk quota In CWP - Control Web Panel Almalinux Centos


Recommended Posts

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 :

Quote

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


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

mount | grep ' /home '


output

Quote

/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"

For Almalinux 9 and above run :

grubby --args="rootflags=uquota,pquota" --update-kernel=ALL

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

For Almalinux check for extra EFI grub config

ls /boot/efi/EFI/almalinux/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.orig
grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg

For Almalinux:

cp /boot/efi/EFI/almalinux/grub.cfg /boot/efi/EFI/almalinux/grub.cfg.orig
grub2-mkconfig -o /boot/efi/EFI/almalinux/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 :

Quote

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


after example :

Quote

/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 ' / '

 

Quote

/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:

Quote

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

before example

Quote

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


after example

Quote

/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,grpquota”  :

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

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...