Steps to Configure Disk Quota in Linux

What Makes RHEL7.0 Robust?
October 21, 2014
Interview Questions Faced by SYED PARVEZ ZAFAR, RHCE
November 25, 2014

Steps to Configure Disk Quota in Linux

Disk space can be restricted by implementing disk quotas which alert a system administrator before a user consumes too much disk space or a partition becomes full.
Disk quotas can be configured for individual users as well as user groups.
In addition, quotas can be set not just to control the number of disk blocks consumed but to control the number of inodes.
The quota RPM must be installed to implement disk quota.
 
To implement disk quotas, use the following steps:
  1. Enable quotas per file system by modifying the /etc/fstab file.
  2. Remount the file system(s).
  3. Create the quota database files and generate the disk usage table.
  4. Assign quota policies.
Enabling Quota
As root, using a text editor, edit the /etc/fstab file.
/dev/aemvg/aemlv        /home     ext4        defaults,usrquota,grpquota      0      0
 
Remounting the File System
mount -o remount /home
 
Creating the Quota Database Files
To create the quota files (aquota.user and aquota.group) on the file system, use the -c option of the quotacheck command.
quotacheck -cug /home
 
After the files are created, run the following command to generate the table of current disk usage per file system with quotas enabled:
quotacheck -avug
 
Assigning Quotas per User
edquota username   OR
setquota -u student 2048 4096 /home
 
Enabling and Disabling
quotaon  -vaug
quotaoff  -vaug
 
Display Quota Status
repquota /home