Quota is useful for limiting the disk usage for users or groups.
###To verify that the quota is enabled in the kernel###
#grep CONFIG_QUOTA /boot/config-`uname -r`
#grep CONFIG_QUOTA /boot/config-`uname -r`
CONFIG_QUOTA=y
CONFIG_QUOTA_NETLINK_INTERFACE=y
# CONFIG_QUOTA_DEBUG is not set
CONFIG_QUOTA_TREE=y
CONFIG_QUOTACTL=y
[root@rajat rajat]#
CONFIG_QUOTA_NETLINK_INTERFACE=y
# CONFIG_QUOTA_DEBUG is not set
CONFIG_QUOTA_TREE=y
CONFIG_QUOTACTL=y
[root@rajat rajat]#
Create user :
useradd some_user
passwd latarEdit /etc/fstab :
From :
/dev/sdaX /home ext3 defaults 1 2
To :
/dev/sdaX /home ext3 defaults,usrquota,grpquota 1 2Remount the disk (make sure it’s not in use) :
mount -o remount /home
useradd some_user
passwd latarEdit /etc/fstab :
From :
/dev/sdaX /home ext3 defaults 1 2
To :
/dev/sdaX /home ext3 defaults,usrquota,grpquota 1 2Remount the disk (make sure it’s not in use) :
mount -o remount /home
Check if usrquota and grpquota are enabled :
mount | grep /home
Create quota files :
quotacheck -cvug /home
This creates /home/aquota.user and /home/aquota.group
Check quota :
#quotacheck -avug
Enable quota for user1 :
edquota user1
Edit soft and hard limits (1000 = 1 MB) or inode values.
Check the quota for user1 :
quota user1
Enable quota :
quotaon -avug
In addition :
Through a cron, run everynight when the filesystem is not used :
quotaoff -avug && quotacheck -avug && quotaon –avug
Get quota stats :
repquota -a