Skip to content

            Lost ?  |  Need an account:
 
Home >> Knowledge Base >> Operating Systems >> Linux >> Linux Quota Tutorial - Assigning Quota Policies
Linux Quota Tutorial - Assigning Quota Policies PDF Print E-mail
(6 votes, average 4.83 out of 5)
Written by Tom Hirt   
Tuesday, 26 May 2009 13:52
Article Index
Linux Quota Tutorial
Quota Configuration
Assigning Quota Policies
All Pages

 

Assigning Quota Policies


Now that we have configured our system with quota support, we are now ready to assign quota policies for our users and groups.

Before we begin however, its important to understand some of the terminology for policy enforcement.  We will begin with limits.  There are two types of limits, soft and hard.  A soft limit provides a threshold for block count and/or inode usage that will trigger a warning message to a user/group once exceeded if used in conjunction with a grace period - more on grace periods in a moment.  A hard limit, which also requires a grace period to be set, servers as a boundary for block counts and/or inode usage that a user/group can not exceed.

Grace periods serve as a count down for soft limit enforcement.  Once the soft limit threshold has been passed, the grace period count down begins.  Once the user/group's grace period has run out, the soft limit will be enforced as a hard limit.  Grace periods are configured on a per file system bassis and can be set to seconds, minutes, hours or days.

Now that we understand limits and grace periods, we are ready to setup a quota.  In the following example, we will set a quota for the user thirt, and set the default grace period for the / and /home file systems.  We will set a block soft limit of 90MB, hard limit of 100MB with a 7 day grace period for /home and /.  Let's begin!

  1. Start by editing the user's quota

    [root@Linux01 /]# edquota thirt

  2. When edquota runs, you will be sent into the editor specified by your $EDITOR environment variable. 

    Note: If you are using the pico or nano editors, be very careful to avoid the line wraps associated with editing this file.  Each file system should be contained on 1 line only!

    You will see each of the file systems we have enabled quota support on (from the /etc/fstab) listed with the currently in-use blocks and inode counts for the user.  Edit the users quota by changing the soft/hard columns of either the blocks and/or inodes for a given file system. 

    In the below, we will sets thirt's block quota to a warning limit of 90MB (90MB x 1024K = 92160 blocks) and a panic limit of 100MB (100MB x 1024K = 102400 blocks) on the /home file system (/dev/mapper/VolGroup00-LogVol00)
    Disk quotas for user thirt (uid 500):
    Filesystem blocks soft hard inodes soft hard
    /dev/mapper/VolGroup00-LogVol04 0 0 0 0 0 0
    /dev/mapper/VolGroup00-LogVol00 88 92160 102400 13 0 0
    Note: A soft/hard limit of zero means no limit will be enforced

  3. Set the default grace period for each file system (this can be overridden on a per user bassis with a -T command line switch, see the edquota man pages for additional details.)

    Set the default grace period for the / file system:
    [root@Linux01 /]# edquota -f / -t

    Grace period before enforcing soft limits for users:
    Time units may be: days, hours, minutes, or seconds
    Filesystem Block grace period Inode grace period
    /dev/mapper/VolGroup00-LogVol04 7days 7days

    Set the default grace period for the /home file system:
    [root@Linux01 /]# edquota -f /home -t

    Grace period before enforcing soft limits for users:
    Time units may be: days, hours, minutes, or seconds
    Filesystem Block grace period Inode grace period
    /dev/mapper/VolGroup00-LogVol00 7days 7days

  4. Verify the quota configuration

    Print all file systems and user/group quota information:
    [root@Linux01 /]# repquota -a
    *** Report for user quotas on device /dev/mapper/VolGroup00-LogVol04
    Block grace time: 7days; Inode grace time: 7days

    Block limits File limits
    User used
    soft
    hard
    grace used
    soft
    hard
    grace
    root -- 2391528 0 0 89211 0 0
    rpm
    -- 796 0 0 49 0 0

    *** Report for user quotas on device /dev/mapper/VolGroup00-LogVol00
    Block grace time: 7days; Inode grace time: 7days

    Block limits File limits
    User used
    soft
    hard
    grace used
    soft
    hard
    grace
    root -- 41428 0 0 8 0 0
    thirt
    -- 88 92160 102400 13 0 0

    Print a single user/groups quota information
    [root@Linux01 /]# quota thirt
    Disk quotas for user thirt (uid 500):
    Filesystem blocks quota limit grace files quota limit grace
    /dev/mapper/VolGroup00-LogVol00 88 92160 102400 13 0 0

 

That's it!  You should now be well on your way to configuring quotas in Linux!  Best of luck!

 


Add this page to your favorite website
AddThis Social Bookmark Button


Comments
Add New Search
David Ramirez  - Journaling support for quota |21/12/2011 14:20:36
Some newer implementations will warn about the kernel offering journaling for the quota system, such as:
quotacheck: Your kernel probably supports journaled quota but you are not using it.
Consider switching to journaled quota to avoid running quotacheck after an unclean shutdown.

Declaring the partition to be under quota with the following modifications (insert j) should enable the journaling feature:
(e.g.)
/dev/mapper/vg_host-LogVol02_export /export ext4 defaults,usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0 1 2

After doing this the quotacheck was run with -c to recreate the quota files and now it runs fine.
Write comment
Name:
Email:
 
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
:D:):(:0:shock::confused:8):lol::x:P:oops::cry::evil::twisted::roll::wink::!::?::idea::arrow:
 
Please input the anti-spam code that you can read in the image.

!joomlacomment 4.0 Copyright (C) 2009 Compojoom.com . All rights reserved."

Last Updated on Tuesday, 02 June 2009 10:07
 

Forum Activity

Author:
Author: kenny22
Jan.24.12
Author: AaronRiley
Jan.15.12

Online Stats

Guests Online: 66
Members Online: 0