Setting up quotas on an XFS partition on vps

If you are encountering following error during adding user account in directadmin then you need to setup quota in your vps server.

we replace the grpquota with pquota (project quotas), which will allow DA to setup directoy quotas, for things like enforcement of per-domain disk quotas.

To confirm what setup you have, run the df commmand

[root@es7-64 ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   14G  2.3G   12G  17% /
devtmpfs                 915M     0  915M   0% /dev
tmpfs                    921M   24K  921M   1% /dev/shm
tmpfs                    921M  8.5M  912M   1% /run
tmpfs                    921M     0  921M   0% /sys/fs/cgroup
/dev/sda1                497M  125M  372M  26% /boot
[root@es7-64 ~]#

as you can see, /home is not a partition, so it falls under the / partition, so we must ensure that quotas are functional on the / partition.

Next confirm that / is actually using the xfs file system

[root@es7-64 ~]# mount | grep ' / '
/dev/mapper/centos-root on / typexfs(rw,relatime,attr2,inode64,noquota)

if you see the “noquota” option, then you need to go to step 1, below.
If you don’t see noquota, then you should be able to follow the standard quota setup guide, but adding uquota,pquota to the /etc/fsab, after the default option.

If you see “noquota” in the xfs mount options for the / partition

Step1: Because “noquota” is a default kernel mounting option, we must change it in the kernel boot options.
Edit the file: /etc/default/grub

vi /etc/default/grub

Step2: Find the line with the variable “GRUB_CMDLINE_LINUX”, that might look like this (it may not look exactly the same, don’t worry):

GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/swap vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root crashkernel=auto  vconsole.keymap=us rhgb quiet"

Step3: We’re going to put a “rootflags=” variable at the end of the line
– And add uquota,pquota as the values
It might look something like this:

GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/swap vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root crashkernel=auto  vconsole.keymap=us rhgb quiet rootflags=uquota,pquota"

Step4: Now, based on that setup, we’ll backup, then create a new grub.cfg file:

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

Step5: Lastly, we must reboot the box in order for the kernel to see these new options

reboot

6) We keep our fingers crossed that the box comes back, and login again.  Go back to step 0) to check the mounting options to ensure that “noquota” is gone, eg:

[root@es7-64 ~]# mount | grep ‘ / ‘
/dev/mapper/centos-root on / type xfs (rw,relatime,attr2,inode64,usrquota,prjquota)
[root@es7-64 ~]#

Once it’s gone, we want to see usrquota,prjquota(or uquota,pquota, they’re the same thing).
If you don’t see, them, then add them to the / partition with the standard quota setup guide.

Step7: Ensure that DirectAdmin has xfs quotas enabled in the directadmin.conf:

cd /usr/local/directadmin
./directadmin c | grep use_xfs_quota

Step8: If there are already Users created in DA, then you’ll also want to reset their quota limits:

echo "action=rewrite&value=quota" >> /usr/local/directadmin/data/task.queue


Thats it.

This article is taken from https://help.directadmin.com/item.php?id=557

Was this article helpful?
YesNo

Leave a Reply

Your email address will not be published. Required fields are marked *