Home > Support > HOWTO List > Disk quotas

Disk quotas

Disk quotas let you set the maximum amount of disk space a particular user is allowed to have on your server.  The disk space used by a user is the sum of all the file sizes owned by their user id.

Enabling disk quotas via /etc/fstab

Disk quotas will only work if you have set a quota option in your /etc/fstab.

You need to have a usrquota and/or grpquota option on the file system on which you wish to use quotas.  e.g. in /etc/fstab you would have something like:

/dev/xvda1 / ext3 defaults,noatime,usrquota,grpquota 1 0

The xvda1 bit may be something like sda1, hda1 etc.  Leave that part alone in your /etc/fstab.  Just add the usrquota,grpquota part.

Setting Up Disk Quotas


# reload the mount points with the quota settings enabled
mount -o remount /

#install quota (if not there alread)
apt-get install quota

# will set up the quota files
quotacheck -acguvm

# -m is needed, else you may get:
# quotacheck: Cannot remount filesystem mounted on / read-only so counted values might not be right.
# Please stop all programs writing to filesystem or use -m flag to force checking.

# -c is needed, else you may get an error like
# quotacheck: Can't find filesystem to check or filesystem not mounted with quota
# edquota: Quota file not found or has wrong format.
# quota: Quota file not found or has wrong format.

# should happen on reboot (in /etc/rc.d/rc.sysinit)
quotaon -avug

Using disk quotas

Now if you run:

repquota -a

It will show how much disk space each user is using.

To assign a quota to a user (per http://www.tldp.org/HOWTO/Quota-4.html):

edquota -u ausername