Setup and Use of the Disk Quota System


Contents

About This Document
    Related Documentation
About the Disk Quota System
When to Use the Quota System
Setup of the Disk Quota System
Disk Quota Fixes

About This Document

This document explains how to set up a disk quota system and applies to all versions of AIX.

Related Documentation

For more information, see the "Disk Quota System Overview" in the System Management Guide and the edquota command.

The AIX and RS/6000 product documentation library is also available:

http://www.rs6000.ibm.com/resource/


About the Disk Quota System

A disk quota system, providing a method for controlling disk space usage, has been implemented in AIX Versions 3.2 and 4.x. This system is based on the Berkeley Disk Quota System and allows assignment of quotas for the AIX journaled file system only.

Disk quotas may be assigned based on three parameters and can be modified with the edquota command. The three parameters are:

The disk quota system tracks user and group quotas in the quota.user and quota.group files. These files reside in the root directories of file systems that have quotas assigned. These files are created with the edquota and quotacheck commands and are readable with the quota commands.


When to Use the Quota System

Typically, quotas are only used for file systems that contain user home directories and files. It is recommended that disk quotas never be assigned for the /tmp file system.

A system administrator would consider implementing the disk quota system under the following conditions:


Setup of the Disk Quota System

To set up the disk quota system, you must have root-user-level authority.

  1. Determine the file systems to which you will apply quotas (user directories default to the /home file system).

  2. The stanza that applies to the /home file system (or to another file system to which you are applying quotas) should be identified and edited in the /etc/filesystems file so that it includes quota, userquota, and groupquota configuration attributes.

    Here is an example stanza line that enables user quotas:

       quota = userquota 
    

    In a file system that has both user and group quotas enabled, the entry might look similar to the following:

       /home: 
             dev       = /dev/hd1 
             vol       = "/home" 
             mount     = true 
             check     = true 
             free      = false 
             vfs       = jfs 
             log       = /dev/hd8 
             quota     = userquota,groupquota 
             options   = rw 
    
  3. You have the option of specifying disk quota file names. The default files are quota.user and quota.group, located in the root directory of the file system enabled with quotas. You may specify alternate names or directories for these quota files with the userquota and groupquota attributes.

    Here is a sample:

       /home: 
             dev        = /dev/hd1 
             vol        = "/home" 
             mount      = true 
             check      = true 
             free       = false 
             vfs        = jfs 
             log        = /dev/hd8 
             quota      = userquota,groupquota 
             userquota  = /home/myquota 
             groupquota = /home/myquota 
             options    = rw 
    
  4. If the file systems are not mounted, mount them.

  5. Use the edquota command to set the user or group soft and hard limits. The edquota command has the following syntax:

    User Quotas

       edquota  -u  ( -p Proto-UserName ) UserName .. 
    

    Group Quotas

       edquota  -g ( -p Proto-GroupName ) GroupName ... 
    

    When -p is used with the -u flag, it duplicates the quotas established for a prototypical user for each specified user.

    The edquota command creates and edits quotas. It creates a temporary file that contains each user's and group's current disk quotas. It determines the list of file systems with established quotas from the /etc/filesystems file.

    The edquota command invokes the vi editor (or the editor specified by the EDITOR environment variable) on the temporary file, so that quotas can be added and modified.

    The fields that are displayed in the temporary file are:

    NOTE: A hard limit with a value of 1 indicates that no allocations are permitted. A soft limit with a value of 1, in conjunction with a hard limit with a value of 0, indicates that allocations are permitted only on a temporary basis.

    More information on the edquota command can be found in the edquota man page or in the softcopy and hardcopy product documentation.

    Here is a sample edquota command and editing session:

       #edquota -u bill 
          Quotas for user bill: 
          /home: blocks in use: 16, limits (soft = 10, hard = 30) 
                 inodes in use: 4, limits (soft = 0, hard = 0) 
    

    Change User or Group Grace Period

        edquota  -t  -u   |  -g 
    
    -t changes the grace period during which quotas can be exceeded before a soft limit is imposed as a hard limit. The default value of the grace period is 1 week. When invoked with the -u flag, the grace period is set for all file systems with user quotas specified in the /etc/filesystems file. When invoked with the -g flag, the grace period is set for all file systems with group quotas specified in the /etc/filesystems file.

    NOTE: If the grace period is changed and repquota shows that some users have already reached their old grace period - before the new grace period can take effect for these users - these users must reduce their quotas to below their soft limits to reset the old grace period. In the future if these users exceed their soft limits, the new grace period will be in effect.

    Also, if another user (like root) exceeds the quotas of some other user, the grace period as reported by the requota command will show (none). The overlimit must be corrected by the user. Then when the quota limit is exceeded the next time, the grace period will be seen with the correct value.

  6. The quota system must be enabled with the quotaon command, whose purpose is to turn file system quotas on and off. The syntax for the quotaon and quotaoff commands are:
    quotaon  [ -g  -u  -v ] { -a | FileSystem ... } 
    quotaoff [ -g  -u  -v ] { -a | FileSystem ... } 
    

    The quotaon command enables disk quotas for one or more file systems specified by the FileSystem parameter. The specified file system must have an entry in the /etc/filesystems file and must be mounted. The quotaon command looks for the quota.user and quota.group default files in the root directory of the associated file system. These file names may be changed in the /etc/filesystems file.

    By default, both user and group quotas are enabled. The related flags or options are:

    -a
    enables or disables all file systems that are read-write and have disk quotas, as indicated by the /etc/filesystems file. When used with the -g flag, it enables or disables only group quotas in the /etc/filesystems file; when used with the -u flag, it enables or disables only user quotas in the /etc/filesystems file.
    -g
    specifies that only group quotas are enabled or disabled.
    -u
    specifies that only user quotas are enabled or disabled.
    -v
    prints a message for each file system in which quotas are turned on or off.

    Examples:

  7. Use the quotacheck command to check the quota files against actual disk usage. It is recommended that you do this each time you first enable quotas on a file system and after you reboot the system.

    WARNING: It is recommended that the specified file system not be active while the quotacheck command is running. Executing quotacheck on an active file system (that is, one in which users have open files) can result in corrupt or incorrect quota data. Run quotacheck only from single-user mode or from the /etc/rc file during boot up (as shown in subsequent discussion).

    The quotacheck process can be automated during boot up with the following entries added near the end of the /etc/rc file (after execution of the fsck command but before the "multi-user initialization completed" message):

    echo " Enabling file system quotas" 
    /usr/sbin/quotacheck [-g -u -v] { -a | FileSystem...} 
    /usr/sbin/quotaon [-g -u -v] { -a | FileSystem...} 
    

    The quotacheck command checks for file system consistency and has the following format and syntax:

    quotacheck  [-g  -u  -v]  { -a | FileSystem ...} 
    

    By default, both user and group quotas are checked.

    The flags are

    -a
    checks all file systems with disk quotas and read-write permissions indicated by the /etc/filesystems file.
    -g
    checks group quotas only.
    -u
    checks user quotas only.
    -v
    reports discrepancies between the calculated and recorded disk quotas.

    Examples:

  8. You can use the repquota command to print a summary of quotas and disk usage for a file system. If the -a flag is specified instead of a file system, the repquota command prints the summary for all file systems enabled with quotas. By default,
    repquota  [-v  -g  -u] { -a | FileSystem ...} 
      -a    specifies that quotas are printed for all file systems 
            enabled. 
      -g    specifies that only group quotas are printed. 
      -u    specifies that only user quotas are printed. 
      -v    prints a header line before the summary of quotas 
            for each file system. 
    

    Example:

    To print a summary of user quotas in the /home file system, enter:

       repquota -u /home 
    

    The system prints the following information:

                          Block limits               File limit 
    User          used   soft   hard  grace    used  soft  hard  grace 
    root     --     16      0      0              2     0     0 
    lanczi   --     12   3000   5000              3  3600  4500 
    biff     --      8     20     40              2    30    39 
    bill     --     16     10     30  7days       4    11    30 
    

Disk Quota Fixes

Fixes for AIX can be downloaded via the Internet with the FixDist service. For assistance, contact your AIX support center.

For AIX 3.2.5

APAR # Problem Fixed
IX40342 File system quotas may be incorrect. Each new file block is counted twice, causing users to exceed the quota.
IX42766 quotacheck truncates quotas file.
IX42886 quota allows blocks and inodes to become "negative".
IX44418 quotacheck does not account for all files in a file system. When all files are finally removed, the user would have a large block and file count. This was caused by a change in APAR IX42887 which has been superseded by IX44418.

For AIX 4.x

Install the latest version of fileset bos.sysmgt.quota.


Setup and Use of the Disk Quota System: disk.quota.setup.all.cmd ITEM: FAX
Dated: 98/12/21~00:00 Category: cmd
This HTML file was generated 99/06/24~12:42:09
Comments or suggestions?
Contact us