Tuesday, August 18, 2009

User and Group Quota

1) Edit /etc/fstab and add one of these lines

/dev/hda3 /home ext3 defaults,usrquota 1 2
/dev/hda3 /home ext3 defaults,grpquota 1 2
/dev/hda3 /home ext3 defaults,usrquota,gr pquota 1 2

Here /dev/hda3 has my data from home mount point

2) To remount fstab without reboot

mount -oremount /home/

3) Now create file as follows as a root

touch /home/quota.user
touch /home/quota.group
chmod 600 quota.user quota.group

4) Use edquota tool for quota creation

edquota -u ramesh
Quotas for user ramesh:
/dev/hda3: blocks in use: 0, limits (soft=0,hard=0)
inodes in use: 0, limits (soft=0,hard=0)

5) To assign 5MB quota for user ramesh modify as follows

edquota -u ramesh
Quotas for user ramesh:
/dev/hda3: blocks in use: 0, limits (soft=5000,hard=6000 )
inodes in use: 0, limits (soft=5000,hard=5000 )

Hard is a value that can go up to with a grace period

edquota -t ramesh
Time units may be : days,hours,minutes or seconds
Grace period before enforcing soft limit for users
/dev/hda3: block grace period:0 days, file grace period: 0 days

Change it to no of days required

6) To edit group
edquota -g mygroup

7) Command are as follows,

quota -display disk usage and limits
quotacheck -scan filesystem for disk usage
quotactl -manipulate disk quota
quotaon, quotaoff - turnon or off filesystem quota
repquota -summerize quota for file system
rquota -implement quota on remote machine

8) quota -u ramesh shows ramesh's quota
quota -g mygroup shows group quota

9) repquota -a This will produce a quota summary.

No comments: