Setting Up Quotas
How do we set quota in /home partition ?
Steps:1) Edit /etc/fstab 2)Remount the filesystem for which quota is to be set. 3)Creating Quota Configuration Files 4)Initialize The Quota Table 5)Editing the User's Quota
Steps:1) Edit /etc/fstab
We may have to login to single usermod to remount the partition, or can work on the system as normal login. Now we edit the file called /etc/fstab, fstab - static information about the filesystems (man fstab for more details) This file lists all the partitions that are mounted automatically while the system is rebooted, we need to enable quota in this file so that the sytem knows that quota is enabled for this partition. We need to add the option "usrquota" option in this file, more can be read about this at "man 8 mount"
#vi /etc/fstab LABEL=/home /home ext3 defaults 1 2 ---> (old) #vi /etc/fstab LABEL=/home /home ext3 defaults,usrquota 1 2 ---->(edited lable)
Step:2)Remount the filesystem for which quota is to be set.
#mount -o remount <the partition for which quota is set> (example here is /home)
Step:3)Creating Quota Configuration Files.
Per-user quotas for the /home filesystem
# touch /home/aquota.user # chmod 600 /home/aquota.user
Step:4)Initializing The Quota Table:
quotacheck - scan a filesystem for disk usage, create, check and repair quota files, quotacheck examines each filesystem, builds a table of current disk usage, and compares this table against that recorded in the disk quota file for the filesystem.
# quotacheck -vagum -v quotacheck reports its operation as it progresses. Normally it operates silently. -a Check all mounted non-NFS filesystems in /etc/mtab -g Only group quotas listed in /etc/mtab or on the filesystems specified are to be checked. -u Only user quotas listed in /etc/mtab or on the filesystems specified are to be checked. -m Donít try to remount filesystem read-only.
Step:5)Editing the User's Quota.
# edquota -u linux (where linux is the username)
Disk quotas for user linux (uid 500):
Filesystem blocks soft hard inodes soft hard /dev/sda3 5047744 0 0 16530 0 0
To change the above users limit to 6 mb use the following.
Disk quotas for user linux (uid 500): Filesystem blocks soft hard inodes soft hard /dev/sda3 5047744 6000 0 16530 0 0 # edquota -t Grace period before enforcing soft limits for users: Time units may be: days, hours, minutes, or seconds Filesystem Block grace period Inode grace period /dev/sda3 7days 7days
# repquota /home
aquota.user or aquota.group quota file at the filesystem root (version 2 quota,non-XFS filesystems)quota.user or quota.group quota file at the filesystem root (version 1 quota, non-XFS filesystems) /etc/mtab default filesystems
SEE ALSO quotactl(2), fstab(5), edquota, quotacheck, quotaon), repquota SEE ALSO quota(1), quotactl(2), fstab(5), quotaon, repquota, con-vertquota, setquota, edquota, fsck, efsck, e2fsck, xfsck