Friday, September 11, 2009

Setting Quota on CentOS Linux

Setting up Disk Quota on CentOS 5.x or Linux is rather straightforward. I'm assuming you are setting on a partition /dev/sdb1

Step 1: At the /etc/fstab, add "usrquota, grpquota" to the partition you wish to put quota on
/dev/sdb1 /home ext3 defaults,usrquota,grpquota 1 1

Step 2: Initialise aquota.user
# touch /dev/sdb1/aquota.user
# chmod 600 /dev/sdb1/aquota.user

Step 3: Remount the partition
# mount -o remount /dev/sdb1
# less /etc/mtab
(It should show
the list of file system having quota entry in Step 1)

Step 4: Do a Quotacheck commands and turn the quota on
#quotacheck -avugm /dev/sdb1
(The quotacheck command will do a scan and will take a while)
# quotaon -av
# quotatstats
(Check for statistics and possible error encountered)

Step 5: To edit a quota
# edquota -u user_id
(Edit the soft and hard limit respecitvely) or alternatively
# setquota -u user_id 100 200 0 0 -a /dev/sdb1
(where 100 and 200 are the block soft and hard limit respectively)

To quota summary report, do a repquota
# repoquota -a

Further Notes:
For more details readings,

No comments: