User Quota:
Monitoring and controlling disk space usage is another important part of a system administrator tasks. User quota is used to restrict the amount of disk space on each partition by each user.
Steps
- Edit       the file /etc/fstab
# vi /etc/fstab
Search the following line 
“LABEL=/home        /home             etx3                 defaults           1 2”
Just add ‘usrquota’ after the word ‘defaults” as  and grpquota for  group 
“LABEL=/home        /home             ext3                 defaults,usrquota       1 2”
- Remount       the home partrition
# mount –o remount /home
Where –o I used to active comma separator used in fstab
After given a quota we must remount the directory with user quota or if we restart the system , it automatically remount.
- Now       check the mount quota
# quotacheck –avum
Where
            -a : Scan file system with quota enabled
            -v : Verbose mode
            -u : Scan for user quota
            -m : Remount file system with quota enabled
- Now       check the /home
#cd /home
#ls
File aquota.user will created)
- Now       add quota for particular user
# edquota –u username
Output of this command
File System      Block   soft      hard    inode   soft      hard
/dev/hda2      24        0          0           9          0          0
1 block=1Kbyte
Suppose we set the userquota by block size i.e we set the soft limit to 3000 and Hard limit to 4000 i.e. 3M and 4M
/dev/hda2     25        3000    4000       9          0          0
Block and inode has a grace period of 7 days ( by default)
We can set the quota either by setting blocks soft and hard limit of inode ( Number of maximum file created)
- Make       the quota on
# quotaon /home
- We       can generate the quota information 
#repquota /home
Note:
We can generate the file of big size to check the quota
Syntax:
#dd if=/dev/zero of=bigfile bs=1M count=3
To check the quota for particular user after login
#quota
To set the grace period for particular user
#edquota –T username
To assign quota of one user to another user
#edquota –p user1 user2
We can also set the quota for particular user by using following command.
#setquota  -u username 2000 3000 20 25 /home
 
No comments:
Post a Comment