Bootstrap FreeKB - Linux Commands - quotaon (enable quota)
Linux Commands - quotaon (enable quota)

Updated:   |  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 Buy Me A Coffee



Comments


Add a Comment


Please enter 4d27d6 in the box below so that we can be sure you are a human.