Debian Lenny and quota on /home

There is a small how to here however it describes how to install on / partition. Here are clear instructions for /home.

Login as root, do not use sudo, you will not be able to unmount /home partition if you use sudo.

Install quota

user@computer:$ apt-get install quota

Change mount options

user@computer:$ vim /etc/fstab

And use following options for /home partition:

errors=remount-ro,usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0

Here is example /etc/fstab file:

# /etc/fstab: static file system information.
#
#
proc /proc proc defaults 0 0
/dev/sda1 / ext3 errors=remount-ro 0 1
/dev/sdb1 /home ext3 errors=remount-ro,usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0 0 2
/dev/sda5 none swap sw 0 0
/dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0

Create user and group file

user@computer:$ cd /home
touch aquota.user aquota.group

Remount /home

user@computer:$ umount /home
mount /home

Run following commands

user@computer:$ quotacheck -avugm
quotaon -avug

Quota is now enabled on your server

user@computer:$ repquota -u /home
*** Report for user quotas on device /dev/sdb1
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 131212 0 0 2 0 0
artur -- 24 0 0 6 0 0

To add limits for user

In this example soft limit is 1.5GB and hard limit is 2GB

user@computer:$ quotatool -u user -bq 1500MB -l '2000MB' /home

Now when user exceeds his limits this is what will happen:

user@computer:$ mkdir f
mkdir: cannot create directory `f': Disk quota exceeded
Share on TwitterShare on TumblrSubmit to StumbleUponSave on DeliciousDigg ThisSubmit to reddit