Home > Linux > How to configure Disk Quotas On Ubuntu

How to configure Disk Quotas On Ubuntu

A Disk Quotais a limit set by a system administrator that restricts certain aspects of Filesystem Usage. Disk Quotas are very useful in large multi-user environment.

Quotatool is a utility to set filesystem quotas from the commandline.

To install, Open the terminal and type:

#apt-get install quota quotatool

Edit the /etc/fstab & add usrquota and grpquota options to the mount point, so the kernel knows to manage that partition using quotas.

To open “fstab” file, Open the terminal and type:

#gedit /etc/fstab

Already there will be a mount point for example “/”, just modify the following line according your mount point.

# /dev/sda1 UUID=4ea80ca3-37b7-447e-831a-700a38627029 / ext4 defaults,errors=remount-ro,usrquota,grpquota 0 1

After adding, fstab looks like this:

We then need to create 2 files that manage the quota levels in the root of the partition:

To create, Open the terminal and type:

#touch /quota.user /quota.group

#chmod 600 /quota.*

To make the setting take affect we then need to remount the partition

#mount -o remount /

OR

Reboot the system

To check that it worked, investigate /etc/mtab:

To open “mtab” file, Open the terminal and type:

#gedit /etc/mtab

It should look similar to:

/dev/sda1 / ext4 rw,usrquota,usrquota 0 0

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, you must first run quotacheck.

#quotacheck -avugm

Now you need to run quotaon command, quotaon announces to the system that disk quotas should be enabled on one or more filesystems.

#quotaon –avug

Configure how the system is going to manage them:

I’m going to be managing quotas on a per user basis, each user is going to be allowed to store up to 5Gb of data! To configure a user we use the edquota command which will open up an editor.

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

#edquota -u satori -f /

Default quota config file:

After assigning 5GB quota:

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

# quota -u satori

If quota assigned, output like so:

ThankYou

  1. April 10, 2013 at 4:23 am

    This is really interesting, You’re a very skilled blogger. I have joined your feed and look forward to seeking more of your wonderful post. Also, I have shared your website in my social networks!

  2. November 10, 2013 at 9:09 pm

    very good and useful article to start quota.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: