NotesOnQuotas
From Sfvlug
This is based on the Filesystems Quotas HOWTO at TLDP. I found that I was able to summarize it quite quickly.
First, edit /etc/fstab and add usrquota and/or grpquota to the mount flags of the partition. Change the following line
/dev/vg0/homelv /home ext3 nodev,nosuid 1 2
To
/dev/vg0/homelv /home ext3 nodev,nosuid,usrquota 1 2
Next, remount the partition with quota checking enabled.
mount -o remount /home/
And turn quotas on for the filesystem.
quotaon /home/
Now, generate an up to date quota database. This command will create files aquota.user and aquota.group in the top directory of any filesystems that have quotas enabled.
quotacheck -avug
Pick one user and apply a quota to that user.
edquota userguy
Below, I have applied a 1GB soft quota and a 2GB hard quota to the user on this partition. A quota of zero means not to enforce quotas for that purpose for that user, as I have left inode quotas at zero. Only the soft and hard columns can actually be edited, changing the others has no effect. Note, if multiple partitions support quotas, each will be on a separate row.
A hard quota is the maximum disk space the user may use on that partition. The soft quota is temporarily exceedable. The grace period is by default set to seven days. After the grace period, the soft quota becomes the hard quota, so if the soft quota is exceeded for more than the grace period, the user may not store any more on that file system.
Disk quotas for user userguy (uid 1030): Filesystem blocks soft hard inodes soft hard /dev/mapper/vg0-homelv 24 1048576 2097152 6 0 0
Now use the following to clone the first user's quota to all the other users.
edquota -p userguy `getent passwd | awk -F: '$3 > 1000 && $3 < 9999 {print $1}'`
Once the server is rebooted, it will enforce the quotas.
Jeff 20:43, 9 April 2012 (UTC)