Configure Disk Quota on Ubuntu Server

Tags: hardlimitLinuxquotasoftlimitUbuntu

Published on: March 21, 2017 by Anitta Jose

Configure Disk Quota on Ubuntu Server


Disk quotas can be used to limit the amount of disk space or the number of files allocated to a user or members of a group. This prevents one user or group of users from consuming all of the available disk space. It is very useful in large multi-user environment.

Types of quotas

  • Usage quota or Block quota: It limits the amount of disk space that can be used.
  • File quota or Inode quota: It limits the number of files and directories that can be created.

Few basic terms related to disk quota

Soft Limit

This is a warning level where users are informed that they are nearing their limit. If they are not using grace periods, the soft limit is the maximum amount of available space for each user.

Hard Limit

This is the exact limit beyond which a user cannot use. Hard limits are necessary only when the users are using grace periods. If grace periods are enabled, this will be the absolute limit a user can use. Any attempt to consume resources beyond this limit will be denied.

Grace Period

During this period the users are allowed to temporarily violate their quotas by certain amounts if necessary. Linux has provided the default of seven days for both inodes and block usage i.e, a user may exceed the soft limit on either resource for up to seven days. After that, further requests by that user to use files will be denied.

Common disk quota utilities/Commands

  • quota – Display a user’s file system disk quota and usage
  • edquota – Edit user quotas for file system
  • repquota – Summarize quotas for a file system
  • quotaon – Turn file system quotas on and off
  • quotacheck – Scan a file system for disk usage, create, check and repair quota files
  • quotatool – Manipulate file system quotas from the command line
  • /etc/fstab – Configuration file that contains information of all the partitions and storage devices in the system
  • /etc/mtab – Lists all currently mounted file systems along with their initialization options

Configure disk quota on ubuntu

First step is the installation of quota package. Inorder to install quota, Open the terminal and type:

#apt-get install quota quotatool

Now edit the /etc/fstab file. Add usrquota and grpquota options to the mount point, so that the kernel knows it should manage that partition using quotas.

The usrquota and grpquota options are used to enable the user quota and group quota mount option(s) on selected file systems respectively.

Open “fstab” file using your favorite text editor, here I’m using VI editor since it is my favorite:

#vi /etc/fstab

After adding the usrquota and grpquota options, fstab looks like this:

Then we need to create two files that manage the quota levels in the partition. To create, Open the terminal and type:

#touch /quota.user /

The file should be owned by root so change its permission as follows:

#chmod 600 /quota.*

To make the setting take affect, the / has to mounted using the new entries in the /etc/fstab. If you are setting up quota on a local machine, the easiest way is  rebooting the system.

#shutdown -r now

If we’re unable to reboot the system, an alternative method is to remount the partition as shown below:

#mount -o remount /

After re-booting or re-mounting the file system, the partition will show up in the list of mounted file systems as having quotas.

You can confirm the mount options by executing th command


You can get the same result by checking  /etc/mtab file

#vi /etc/mtab

Instead of checking the /etc/mtab, an alternate method is to check /proc/mounts using any of the text editors as shown below:

 #vi /proc/mounts 

Quota Activation

When each quota-enabled file system is remounted, the system is now capable of working with disk quotas. However, the file system itself is not yet ready to support quotas.

To do this, we must first run quotacheck.

#quotacheck -avug

The options and its use are given below:

a – Check all mounted non-NFS file systems in /etc/mtab

v – Display a message for each file system affected

u – Check for user disk quotas

g – Check for group disk quotas

Now run quotaon command, which announces to the system that disk quotas should be enabled on one or more file systems.

#quotaon –avug

The options used in the above command and its use is shown below:

a – Enable disk quotas on all mounted file systems in /etc/fstab

v – Display a message for each file system where quotas are turned on

u – Manipulate user quotas. This is the default.

g – Manipulate group quotas

To assign quota for particular user, Open the terminal and type:

#edquota -u madhav -f /

Now edit the default quota configuration file which is shown below:

We can confirm the change by entering the user quota command in terminal:

#quota -u madhav

In-order to view the quota summary report, use the following command:

#repquota -a

The output of the above command is as follows:

I believe this blog will help you to have a clear view about disk quota 🙂

Get 24/7 expert server management

Category : Linux

Anitta Jose

Anitta Jose

Anitta is systems engineer since 2015 and holds broad experience in Linux, WordPress, and cPanel systems administration. Her interest lies more in Cloud technologies (AWS). From 2016, she writes blogs to share her experiences with wider audience.

You may also read:


Add new commentSIGN IN

Let's Connect


Your Cart

Cart is empty.

Send this to a friend