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 (s)he’s quota) and attempt to assign it to a user. Steps:
- Log in to the server as root
- 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]#
- 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]#
- 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]#
You see the message Disk quota exceeded – this means the disk quota is working fine.
If your disk quotas do not work as expected, please check these cPanel articles: