10.2. Setting Quota Limits

Once you have configured your system to enable quotas, verify that they really are enabled. An easy way to do this is to run


    # quota -v

You should see a one line summary of disk usage and current quota limits for each file system that quotas are enabled on.

You are now ready to start assigning quota limits with the edquota command.

You have several options on how to enforce limits on the amount of disk space a user or group may allocate, and how many files they may create. You may limit allocations based on disk space (block quotas) or number of files (inode quotas) or a combination of both. Each of these limits are further broken down into two categories: hard and soft limits.

A hard limit may not be exceeded. Once a user reaches their hard limit they may not make any further allocations on the file system in question. For example, if the user has a hard limit of 500 blocks on a file system and is currently using 490 blocks, the user can only allocate an additional 10 blocks. Attempting to allocate an additional 11 blocks will fail.

Soft limits on the other hand can be exceeded for a limited amount of time. This period of time is known as the grace period, which is one week by default. If a user stays over his or her soft limit longer than their grace period, the soft limit will turn into a hard limit and no further allocations will be allowed. When the user drops back below the soft limit, the grace period will be reset.

The following is an example of what you might see when you run then edquota command. When the edquota command is invoked, you are placed into the editor specified by the EDITOR environment variable, or in the vi editor if the EDITOR variable is not set, to allow you to edit the quota limits.


    # edquota -u test


    Quotas for user test:

    /usr: blocks in use: 65, limits (soft = 50, hard = 75)

            inodes in use: 7, limits (soft = 50, hard = 60)

    /usr/var: blocks in use: 0, limits (soft = 50, hard = 75)

            inodes in use: 0, limits (soft = 50, hard = 60)

You will normally see two lines for each file system that has quotas enabled. One line for the block limits, and one line for inode limits. Simply change the value you want updated to modify the quota limit. For example, to raise this users block limit from a soft limit of 50 and a hard limit of 75 to a soft limit of 500 and a hard limit of 600, change:


     /usr: blocks in use: 65, limits (soft = 50, hard =

        75)

to:

     /usr: blocks in use: 65,

        limits (soft = 500, hard = 600)

The new quota limits will be in place when you exit the editor.

Sometimes it is desirable to set quota limits on a range of uids. This can be done by use of the -p option on the edquota command. First, assign the desired quota limit to a user, and then run edquota -p protouser startuid-enduid. For example, if user test has the desired quota limits, the following command can be used to duplicate those quota limits for uids 10,000 through 19,999:


    # edquota -p test 10000-19999

The ability to specify uid ranges was added to the system after 2.1 was released. If you need this feature on a 2.1 system, you will need to obtain a newer copy of edquota.

See man edquota for more detailed information.



Banner.Novgorod.Ru