How to Configure Disk Quotas in Linux

If you have mounted a new drive on your cloud Linux server but during the process you forget to enable quota or if your cPanel accounts are showing 0 MB disk usage, then this article will help you to configure the quotas on your server.

First of all you need check if the quota is enabled on your new mounted partition or not

Use the below command:

repquota /home2
repquota: Mountpoint (or device) /home1 not found or has no quota enabled
repquota: Not all specified mountpoints are using quota.

The output clearly shows that quota is not enabled on server.

Now to enable the quota, Just open the /etc/fstab file on your terminal and add the user quota to your new mounted drive.

cat /etc/fstab

I have added noatime on our newly added drive.

Use the below command to remount the drive to enable the added quota.

mount -o remount /home2

Use the below command to create User Quota Database File to /home2 directory.

touch aquota.user

Set file permissions to 600.

root@srever [/home2]# chmod 600 aquota.user

By default the owner & group permission is root. Modify it once again:

chown root:root aquota.user

Now use the below command to enable the User Quota to /home2 directory users:

root@myserver [/home2]# quotacheck -auvm

Use the below command to check whether user disk usage is shows or not at /home2 directory users.

repquota /home2

Now, It will show the used disk space of all the users.

After enabling the disk quota, You have to fix the user quotas on cpanel server.