Linux Commands - quotaon (enable quota)

by
Jeremy Canfield |
Updated: March 22 2020
| Linux Commands articles
This assumes you have installed quota using apt-get or yum.
yum install quota
Edit the /etc/fstab, adding usrquota and grpquota to the directories you want to apply quota to. In this example, user quota and group quota are applied to the /var directory.
/dev/mapper/centos-root  /var   ext4   defaults,usrquota,grpquota   1  2
You can either reboot the system for this change to take effect.
reboot
Or, you can unmount and then remount the filesystem for the quota to be activated on the filesystem.
umount /var
mount /dev/mapper/centos-root /var
Use the quotaon command to turn on quotas.
quotaon /var
Use the ls command to verify that quotas have been created. There should be two new files; aquota.user and aquota.group.
ls /var
. . .
aquota.user aquota.group
To verify the quota limit will function properly, switch to another user account, and attempt to create a new file.
[john.doe@server1 ~]# su - jane.doe
[jane.doe@server1 ~]# echo "Hello World" > example.file
Error writing filename: Disk quota exceeded
Did you find this article helpful?
If so, consider buying me a coffee over at