User / Group Disk Quotas A three Step Guide

A disk quota is a limit set by a system administrator that restricts certain aspects of file system usage on modern operating systems. "Wikipedia"

Requirements : Quota Package

Where to get it : Quota package is generally available in majority of Linux Distros but still if your distro doesn't provide you with Quota compile it from http://sourceforge.net/projects/linuxquota/ :)

Step 1) Installation :

a) openSUSE : yast -i quota

b) Ubuntu : sudo apt-get install quota

c) Fedora : yum install quota

d) Others : Use rpm or compile if not available

 

Step 2) Enable Disk Quota

Disk quota is generally applied on a user or a set of users to its recommended to enable Disk Quota on your Home partition dont enable quota on the root partition unless you are under the expert category

To enable disk quota in certain partition just add "usrquota,grpquota" to that partition in your fstab you need root privileges to do this of course.

Following is my sample fstab entry for /home

/dev/sda9 /home ext3 acl,user_xattr,usrquota,grpquota 1 2

After you have added the entry in fstab you need to create the aquota.user and aquota.group files in the partition where you have enabled quota /home in our case use the following command in /home directory

touch aquota.user

touch aquota.group

chmod 600 aquota.user

chmod 600 aquota.group

Now a reboot is recommended

 

Step 3) Limiting Users on Quota

Now its the time to give quota to user/groups using the following command

edquota -u <username>

or

edquota -g<groupname>

This will open up the configuration file which would look something like this

Disk quotas for user <user> (uid <uid>)

Filesystem blocks soft hard inodes soft hard

/dev/sda9 9215 1048576 1050624 603 0 0

You would notice soft, hard and inodes in this file i would recommend not to use inode as using this would be limiting user on the number of files to create specify size in KB for soft and hard part soft is actually the limit and after soft limit is reached the user is given a grace on size to a maximum mentioned as hard

This completes quota :)

Now how to apply same settings for different users, For instance, to use the same settings for user "nagar" that you set for user "abhishek", you would enter:

edquota -p abhishek -u nagar

 

Further Study http://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-disk-quotas.html


1 comment

14
Sep

user disk quotas in SUSE

hallo,
im student from Malaysia..i very2 need help..i was giving assigment about how to set user disk quotas..can you give me full tutorial how to set it.. i need to make a video about this..this is very2 urgent, im so tired to find solution..hope you can help me a.s.a.p
tanks so much