How to check if disk quotas work properly

This KB article is intended for CentOS with cPanel servers.

You are selling shared hosting accounts and you want to be sure that your users don’t exceed their disk space quotas? You can easily find if the disk quotas work as expected.

Mainly, as root, you will create a big file size (that added to a user account will exceed the quota) and attempt to assign it to a user.  Steps:

1. Log in to the server as root

2. Navigate to a user’s home directory (in this example the user is plothost) and create a file of 100M (or 1000M etc). In our test case, the plothost‘s plan has 50M space – so, if everything works as expected, we will not be able to add a 100M file.

root@web [~]# cd /home/plothost/
root@web [/home/plothost]# 
root@web [/home/plothost]# dd if=/dev/zero of=test_file bs=100M count=1
1+0 records in
1+0 records out
104857600 bytes (105 MB) copied, 0.527468 s, 399 MB/s
root@web [/home/plothost]#

3. Check the ownership of the file

root@web [/home/plothost]# ll test_file
-rw-r--r-- 1 root root 104857600 Jan 23 11:25 test_file
root@web [/home/plothost]#

4. Now try to assign the test file to the user

root@web [/home/plothost]# chown plothost:plothost test_file
chown: changing ownership of 'test_file': Disk quota exceeded
root@web [/home/plothost]#
cpanel logo
cPanel logo

If your disk quotas do not work as expected, please check these cPanel articles:

cPanel – Initial Quota Setup  |   cPanel – How to Fix Quotas

Leave a Reply