Monday, May 5, 2014

Disk Quotas (managing quotas for user)

Add 'usrquota' option in /etc/fstab file for /home directory
 then remount home partition

# mount -o remount /home
# mount |grep home

# quotacheck -cum /home
c = creates quota table options
u = creates aquota.user file
m = tells do not remount /home dir in read only mode

To view user's quota table run
# edquota -u user 

Limiting the space for the user 
# setquota -u user 30000 35000 0 0 /home 


Turn on quotas for the home directory 
# quotaon /home

Fill the disk with bunch of zeros

# dd if=/dev/zero of=testfile bs=1024 count=25000

Check what is the status of the user for the quotas
# edquota -u user

Copy quota settings from user to user
# edquota -up user1 user2

We can see all the users quotas with
# repquota -a

Group quotas are also similar to user quotas

In the /etc/fstab file you should enter 'grpquota' on the mount point

Then remount the filesystem you have grpquota
# mount -o remount /mountpoint
# mount |grep mountpoint (should show grpquota option on the output)

Add quota file to the location
# quotacheck -cgp /mountpoint

Turn the quota on
# quotaon /mountpoint

Set quota for the group
# setquota -g groupname 99000(99MB) 12000 0 0 /mountpoint

You can check the quotas in the all groups with
# repquota -ga

No comments:

Post a Comment