You are here: Home / Debian GNU/Linux / System / Setup / Setup disk quotas on Debian

Setup disk quotas on Debian

by Pierre-Yves Landuré last modified Nov 11, 2017 09:30

Quotas are a simple mean to limit the disk usage of some software or users. This article list some of the methods used to implement disk quotas on Debian.

This howto is tested on :

  • Debian 6.0 Squeeze

Quotas on folders

Quotas described in this article are global to file systems. To set quotas on different folders for a unique user, the easiest way is to use the Logical Volume Manager LVM or loopback devices. Create an LVM disk for each folder you want the size of limited.


Operating System configuration

Load the kernel module responsible for the management of quotas, and make sure it is loaded at system startup :

command modprobe quota_v2
if [ -z "$(command grep 'quota_v2' '/etc/modules')" ]; then
  command echo 'quota_v2' >> '/etc/modules'

Install the quotas management tools :

command apt-get install quota quotatool

File System configuration

To support quotas, a file system must be mounted with the "usrquota" option.

Provide the file system device for witch you want to enable quotas :


Add the usrquota option to file system fstab line :

command sed -i \
    -e "s|^\(${FS_DEV}[ \t]*[^ \t]*[ \t]*[^ \t]*[ \t]*[^ \t]*\)\([ \t].*\)$|\1,usrquota\2|" \

Remount the file system with the needed option :

command mount -o remount,usrquota "${FS_DEV}"

Fetch the file system mount point :

FS_MOUNT="$(command mount \
    | command grep "${FS_DEV}" \
    | command cut --delimiter=" " --fields=3)"

Create the quotas informations storages :

if [ ! -e "${FS_MOUNT}/aquota.user" ]; then
  command touch "${FS_MOUNT}/aquota.user"
  command chmod 600 "${FS_MOUNT}/aquota.user"
if [ ! -e "${FS_MOUNT}/aquota.qroup" ]; then
  command touch "${FS_MOUNT}/"
  command chmod 600 "${FS_MOUNT}/"

Enable quotas for the file system :

command quotacheck -vagum


Place a 250MB quotas on /home for current user :

command quotatool -u "${USER}" -bq '200M' -l '250 MB' /home

Show all the quotas placed on /home :

command repquota /home