Quota is used to limit the space used for a user or group. In Linux the quota related information is stored in a database called quota database. In order to set quota for user or group, this quota database need to be created.
Steps to configuring Disk Quotas
1. Enable quotas for file system in /etc/fstab file.
/dev/VolGroup00/LogVol01 /home ext3 defaults,usrquota,grpquota 1 2
2. Remount the file system(s).
mount -o remount /home
3. Create the quota database files and generate the disk usage table.
#Command to create user,group quota database for directory /home
quotacheck -cug /home
The above command will create file aquota.user at /home. The -c option specifies that the quota files should be created for each file system with quotas enabled, the -u option specifies to check for user quotas, and the -g option specifies to check for group quotas.
#Run the following command to generate the table of current disk usage per file system with quotas enabled
quotacheck -avug
4. Allocate quota
#For user (Say guest)
edquota guest
Disk quotas for user guest (uid 501):
Filesystem blocks soft hard inodes soft hard
/dev/sda 440436 500000 550000 37418 0 0 <----- Now edit the values and save.
#Simiarly allocate quota for group (Say dba)
edquota -g dba
#Allocate quota for all users in system
edquota -t (for all users)
5. Enabling and Disabling quotas.
#To disable quota for user on all file systems
quotaoff -vau
#To disable quota for group on all file systems
quotaoff -vag
#To enable quota for user on all file systems
quotaon -vau
#To enable quota for group on all file systems
quotaon -vag
#To enable quotas for a specific file system (Say /home)
quotaon -vug /home
6. Display quota details
#To verify quota set for the user (Say guest)
quota guest
#Report quota details for file systems (Say /home).
repquota /home
#Report quota details for all file systems.
repquota -a
No comments:
Post a Comment