Imposing limits on the amount of storage a user can consume is an effective way to manage resources and ensure they are made available to everyone fairly, especially in a multiuser environment. This recipe shows you how to enable quotas and set limits by users and groups.
This recipe requires a CentOS system with administrative privileges provided by logging in with the root
account or using sudo
. It assumes /home
mounts its own filesystem.
Follow these steps to set up quotas and specify storage limits:
Open the
/etc/fstab
file for editing:vi /etc/fstab
To enable user quotas, which enforce usage limits based on user accounts, add
uquota
to the mount options for/home
. For group quotas, addgquota
. Bothuquota
andgquota
can be given together to enable both:/dev/mapper/centos-home /home xfs defaults,uquota,gquota 0 0
Save your changes and close the file.
Reboot the system:
shutdown -r +5 'Reboot required for system maintenance...