Let's say that your /home partition is in / mount point
install quota on your centos
yum install quota
Edit: /etc/fstab
vi /etc/fstab
replace "defaults" with "usrjquota=quota.user,jqfmt=vfsv0" for / mount point
Before (in some cases this can be different!):
UUID=ac567666-9385-4ef5-885c-80f61ec64647 / ext3 defaults 1 1
After Replace: UUID=ac567666-9385-4ef5-885c-80f61ec64647 / ext3 usrjquota=quota.user,jqfmt=vfsv0 1 1
mount -o remount /
quotacheck -avugm
quotaon -avug
If you have /home in /etc/fstab then you will need to edit line matching /home
replace "defaults" with "usrjquota=quota.user,jqfmt=vfsv0" for /home mount point
Before: UUID=ac567666-9385-4ef5-885c-80f61ec64647 /home ext3 defaults 1 1
After Replace: UUID=ac567666-9385-4ef5-885c-80f61ec64647 /home ext3 usrjquota=quota.user,jqfmt=vfsv0 1 1
mount -o remount /home
quotacheck -avugm
quotaon -avug
Now you need to add this into the CWP Configuration
mkdir -p /usr/local/cwp/.conf/
echo "/home" > /usr/local/cwp/.conf/quota_part.conf
How to check if quota works ?
repquota -a
This will display you user limits
Set a quota for all users by package from cwp
/scripts/cwp_api account update_diskquota_all
If you had previously added users then you will need to update the quota for them, you can do that by clicking on each account edit and then saving changes, or you can edit packages and save them for all users.
XFS Quota (only for XFS file system!!!)
yum -y install quota quota-devel
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
aftere example
/dev/mapper/centos_root-home /home xfs defaults,usrquota,grpquota 0 0
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
reboot the server
Next, activate quota for all accounts
in cwp.admin go to Left Menu -> Packages -> List Packages
edit all packages you have and select "Update Quota" to set the quota for all accounts using this package.
How to check if /home is mounted with quota
mount |grep home
if you have there listed usrquota,grpquota for /home then all should work fine.
=============
XFS: In some cases, you would also need to modify grub conf if the above fails
# mount | grep ' / '
/dev/mapper/cl-root on / type xfs (rw,relatime,attr2,inode64,noquota)
If you see "noquota" in the xfs mount options for the / partition then you would need to modify file: /etc/default/grub
Find the line with the variable "GRUB_CMDLINE_LINUX" and at end of the line add: "rootflags=uquota,pquota"
Example:
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet rootflags=uquota,pquota"
Make backup and create grub config for boot
cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.orig
grub2-mkconfig -o /boot/grub2/grub.cfg
echo xfs > /usr/local/cwp/.conf/quota_type.conf
now reboot the server
reboot
after reboot run API to set quota for all users
/scripts/cwp_api account update_diskquota_all
Note: If you want emails and user home to be under the same quota then /var/vmail and /home need to be on the same partition.