QUOTA

Why:-

Have you ever encountered a situation where your children who are using your PC are hoarding music and video on the harddisk and filling up all the space ? In linux, there is a way for you to prohibit others from hogging all the disk space. This you do by using quotas. Here I will explain how to setup disk quotas in Linux.

 

Step 1.  First mount the partition with quota file system

In my example I mount “/dev/sdb1” mount on “/home” with usrquota.

clip_image002

clip_image004

Step 2. Update this information in “/etc/fstab”

clip_image006

 

Step 3. Check aquota.user file created in the “/home” directory.

 

clip_image008

clip_image010

Step 4. Create a user and locate home directory in quota enabled partition “/home”

Check all the information of quota on /home directory with “repquota –s /home”

clip_image012

clip_image014

clip_image016

Step 5. Now apply quota for user “eric”

In my example I set 5MB space for user “eric”

clip_image014[1]

clip_image017

 

Blocks : The amount of space in 1k blocks the user is currently using

inodes : The number of files the user is currently using.

Soft Limit : The maximum blocks/inodes a quota user may have on a partition. The role of a soft limit changes if grace periods are used. When this occurs, the user is only warned that their soft limit has been exceeded. When the grace period expires, the user is barred from using additional disk space or files. When set to zero, limits are disabled.

Hard Limit : The maximum blocks/inodes a quota user may have on a partition when a grace period is set. Users may exceed a soft limit, but they can never exceed their hard limit.

Check the information update in “repquota”

clip_image019

Information updated.

Step 6. Check quota is working or not.

In my example I login with eric user and create two files “test” and “test1” with approx 4Mb each.

As we know we set quota for eric is 5Mb so 1st file created successfully but in 2nd file quota limit reached from 5Mb so it’s print error.

clip_image021

 

In case of size (block)

clip_image023

 

 

Advance setting:-

To set  grace time for user.

[root@feenixdv data]# edquota -t

clip_image025

 

To send notification about quota limit exceed, quota crash etc.

[root@feenixdv data]# vi /etc/warnquota.conf

·         Set mailing list.