Linux: Disk Quota
A Disk quota allows to limit the amount of disk space and/or the number of files a user can use. The quota tools package usually needs to be installed, it contains the command line tools. Activate the user quota in the fstab and remount the partition. If the partition is busy, either all locked files must be closed, or the system must be rebooted.
Add usrquota to the fstab mount options,
for example:
Modify /etc/fstab file
#vi /etc/fstab
/dev/sda2 /home ext3 defaults,quota 1 2
:wq!
To apply quota permissions unmount & again mount the /home file system.
# mount -o remount /home
Initialize the quota user file with quotacheck or check quota status
# quotacheck -v /home
Activate the quota with
#quotaon /home
Assign quota limits
The quotas are not limited per default (set to 0). The limits are set with edquota/setquota for single user. A quota can be also duplicated to many users. The file structure is different between the quota implementations, but the principle is the same: the values of blocks and inodes can be limited.
Only change the values of soft and hard. If not specified, the blocks are 1k.
# edquota -u sam #Disk quotas for user sam (uid 107):
Filesystem blocks soft hard inodes soft hard
/dev/sda2 108 1000 2000 1 0 0
Checks
Users can check their quota by simply typing quota Root can check all quotas.
# quota -u sam # Check quota for a user
# repquota /home # Full report for the partition for all users




