Disk quotas are commonly used by ISPs, by Web hosting companies, on FTP sites, and on corporate file servers to ensure continued availability of their systems.
Quotas are used to limit a user’s or a group of user’s ability to consume disk space. This prevents a small group of users from monopolizing disk capacity and potentially interfering with other users or the entire system.
Soft limit
Hard limit
Grace Periods
To do quota we will use edquota, repquota and quotacheck tools to create modify and report quota management.
Quota can be applied to users and groups, block size and inode number.
~]# rpm –qa |grep quota - to verify quota rpm is installed or not
Now open /etc/fstab to open quota
/dev/sdb1 /qcheck ext3 defaults,usrquota,grpquota 1 2
Either reboot or remount the file system to enable quota
~]# mount –o remount,usrquota,grpquota,rw /qcheck
In this case /qcheck is the mount point.
To enable or create a quota file we have to run
~]# quotacheck –cugm /qcheck
quotacheck command options
-v scans and prints verbose
-c performs a new scan
-g scan quota for groups
-m remount the scanned file system
-u scan quota for users
-a Check all quota-enabled, locally-mounted FS
Switch on the quota using below command
~]# quotaon –avug
Now quota is on. Add quota soft and hard limits to any user
Now verify writing some dump data (dd command).
Login as a ravi user then
~]$ dd if=/dev/zero of=/qcheck/test bs=1024 count=10
~]$ dd if=/dev/zero of=/qcheck/test bs=1024 count=21
In above screenshot it is showing that warning and exceeded limits for user ravi.
To verify the quota settings
~]# quota –u <user name>
To increase a grace period for a user
~]# edquota –T <user name>
Enable the quota for a group.
~]# edquota –g <group name>
In this case quota is group name
Removing quota
Switchoff the quota
~]# quotaoff –avugThen clear the entry in /etc/fstab
Remount the partition using
~]# mount –o remount,rw <mountpoint>
It will clear the quota
No comments:
Post a Comment