Linuxdoc Linux Questions
Click here to ask our community of linux experts!
Custom Search
Next Previous Contents

4. Quota setup: tools

This operation is performed with the edquota command (`man edquota` for details).

4.1 Assigning quota for a particular user

Here's an example. I have a user with the login id bob on my system. The command "edquota -u bob" takes me into vi (or editor specified in my $EDITOR environment variable) to edit quota for user bob on each partition that has quota enabled:


Quotas for user bob: 
/dev/hda3: blocks in use: 2594, limits (soft = 5000, hard = 6500) 
         inodes in use: 356, limits (soft = 1000, hard = 1500)

"blocks in use" is the total number of blocks (in kilobytes) a user has consumed on a partition.

"inodes in use" is the total number of inodes a user has consumed on a partition.

4.2 Assigning quota for a particular group

Now I have a group games on my system. "edquota -g games" takes me into the vi editor again to edit quota for the group games:


        Quotas for group games: 
        /dev/hda4: blocks in use: 5799, limits (soft = 8000, hard = 10000) 
                inodes in use: 1454, limits (soft = 3000, hard = 4000)

4.3 Assigning quota for a bunch of users with the same value

To rapidly set quotas for, say 100 users, on my system to the same value as my user bob, I would first edit bob's quota information by hand, then execute:


edquota -p bob `awk -F: '$3 > 499 {print $1}' /etc/passwd`

assuming that you are using csh, and that you assign your user UID's starting with 500.

In addition to edquota, there are 3 terms which you should familiarize yourself with: Soft Limit, Hard Limit, and Grace Period.

4.4 Soft Limit

_Soft limit_ indicates the maximum amount of disk usage a quota user has on a partition. When combined with grace period, it acts as the border line, which a quota user is issued warnings about his impending quota violation when passed.

4.5 Hard Limit

Hard limit works only when grace period is set. It specifies the absolute limit on the disk usage, which a quota user can't go beyond his hard limit.

4.6 Grace Period

Executed with the command "edquota -t", grace period is a time limit before the soft limit is enforced for a file system with quota enabled. Time units of sec(onds), min(utes), hour(s), day(s), week(s), and month(s) can be used. This is what you'll see with the command "edquota -t":


Time units may be: days, hours, minutes, or seconds 
Grace period before enforcing soft limits for users: 
/dev/hda2: block grace period: 0 days, file grace period: 0 days 

Change the 0 days part to any length of time you feel reasonable. I personally would choose 7 days (or 1 week).


Next Previous Contents