Skip to content

            Lost ?  |  Need an account:
 
Home >> Knowledge Base >> Operating Systems >> Linux >> Linux Quota Tutorial - Quota Configuration
Linux Quota Tutorial - Quota Configuration 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


Quota Configuration


Now that we have some background on the Linux Quota system, we are now ready to begin the quota configuration.  Let's get started!

  1. Enable quota support by appending usrquota,grpquota to each of the file systems you wish to enforce a quota on within the /etc/fstab file.  In the below example, we have enabled quota support on / and /home.

    /dev/VolGroup00/LogVol04 /
    ext3 defaults,usrquota,grpquota 1 1
    LABEL=/boot /boot ext3 defaults 1 2
    devpts /dev/pts devpts gid=5,mode=620 0 0
    tmpfs /dev/shm tmpfs defaults 0 0
    /dev/VolGroup00/LogVol00 /home
    ext3 defaults,usrquota,grpquota 1 2
    proc /proc proc defaults 0 0
    sysfs /sys sysfs defaults 0 0
    /dev/VolGroup00/LogVol02 /tmp ext3 defaults 1 2
    /dev/VolGroup00/LogVol03 /var ext3 defaults 1 2
    /dev/VolGroup00/LogVol01 swap swap defaults 0 0
    Note: The contents of your /etc/fstab file may differ.  We have highlighted the additions which were added to our /etc/fstab file.

  2. Remount the file system(s) to enable quota support

    [root@Linux01 ~]# mount -o remount /
    [root@Linux01 ~]# mount -o remount /home

  3. Initalize the new quota database.  After running the quotacheck -cug <FILE SYSTEM> command, you will find a aquota.useraquota.group and file located in the root of each file system.  These files describe the quota policy to be enforced on the file system(s) for each user and/or group and their associated grace time.

    Initializing the database:
    [root@Linux01 /]# quotacheck -cug /
    [root@Linux01 /]# quotacheck -cug /home/

    Verify the creation of the quota database files:
    [root@Linux01 /]# ls -al /aquota*
    -rw------- 1 root root 6144 May 26 17:15 /aquota.group
    -rw------- 1 root root 6144 May 26 17:15 /aquota.user
    [root@Linux01 /]# ls -al /home/aquota*
    -rw------- 1 root root 7168 May 26 17:16 /home/aquota.group
    -rw------- 1 root root 7168 May 26 17:16 /home/aquota.user


  4. Schedule a task in cron to scan the system for quota-checking. You should be aware that scanning the system can be I/O intensive.  Your system may have different needs than the examples given below, but be aware and expect heavy I/O during the times the scans run (scheduling a scan in the middle of the day at peak production usage may not be the best idea.)

    #MIN (0-59) HOUR (0-23)
    DoM (1-31) MONTH (1-12) DoW (0-7) CMD
    0 1 * * 0 quotacheck -vug /
    20 1 * * * quotacheck -vug /home
    Note: In the above example, we have schedule a weekly scan of / for 1:00AM and a daily scan of /home scheduled for 1:20AM

  5. Enable quota support on the file system(s).  The easiest way to enable quota support is to simply reboot the system.  The systems init scripts should automatically enable quota support assuming its supported by the kernel.  Optionally, you can use the quotaon command to enable quota support on a file system without having to reboot the system.

    Note: For some distributions, you may have to enable quota support manually or create an init script to do so for you; consult you distributions documentation for details.

    Enable quota support without a system reboot:
    [root@Linux01 /]# quotaon /home
    [root@Linux01 /]# quotaon /

    Verify quota support is enabled on a file system
    [root@Linux01 /]# quotaon -p /home
    group quota on /home (/dev/mapper/VolGroup00-LogVol00) is on
    user quota on /home (/dev/mapper/VolGroup00-LogVol00) is on
    [root@Linux01 /]# quotaon -p /
    group quota on / (/dev/mapper/VolGroup00-LogVol04) is on
    user quota on / (/dev/mapper/VolGroup00-LogVol04) is on
    [root@Linux01 /]#
    Note: Quota support has been enabled on the /home and / file systems



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: 67
Members Online: 0