[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
System Management Guide: Operating System and Devices

Setting Up the Disk Quota System

Prerequisites

You must have root user authority.

Procedure

  1. Determine which file systems require quotas. Normally, you need to establish quotas only on those file systems that house users' home directories or other user files. The disk quota system can be used only with the journaled file system.
    Note: Because many editors and system utilities create temporary files in the /tmp file system, it should be free of quotas.
  2. Use the chfs command to include the userquota and groupquota quota configuration attributes in the /etc/filesystems file. The following sample chfs command enables user quotas on the /home file system:
    chfs -a "quota = userquota" /home
    To enable both user and group quotas on the /home file system, enter:
    chfs -a "quota = userquota,groupquota" /home
    The corresponding entry in the /etc/filesystems would appear as follows:
    /home:
    dev        = /dev/hd1
    vfs        = jfs
    log        = /dev/hd8
    mount      = true
    check      = true
    quota      = userquota,groupquota
    options    = rw
  3. Optionally, specify alternate disk quota file names. The file names quota.user and quota.group are the default names located at the root directories of the file systems enabled with quotas. You can specify alternate names or directories for these quota files with the userquota and groupquota attributes in the /etc/filesystems file.

    The following sample chfs command establishes user and group quotas for the /home file system, and names the quota files myquota.user and myquota.group:

    chfs -a "userquota = /home/myquota.user" -a "groupquota = /home
            /myquota.group" /home
    The corresponding entry in /etc/filesystems would appear as follows:
    /home:
    dev        = /dev/hd1
    vfs        = jfs
    log        = /dev/hd8
    mount      = true
    check      = true
    quota      = userquota,groupquota
    userquota  = /home/myquota.user
    groupquota = /home/myquota.group
    options    = rw
  4. Mount the specified file systems, if not previously mounted.
  5. Set the desired quota limits for each user or group. Use the edquota command to create each user or group's soft and hard limits for allowable disk space and maximum number of files.

    The following sample entry shows quota limits for user davec:

    Quotas for user davec:
    /home: blocks in use: 30, limits (soft = 100, hard = 150)
            inodes in use: 73, limits (soft = 200, hard = 250)
    This user has used 30KB of the maximum 100KB of disk space. Of the maximum 200 files, davec has created 73. This user has buffers of 50KB of disk space and 50 files that can be allocated to temporary storage.

    When establishing disk quotas for multiple users, use the -p flag with the edquota command to duplicate a user's quotas for another user.

    To duplicate the quotas established for user davec for user nanc, enter:

    edquota -p davec nanc
  6. Enable the quota system with the quotaon command. The quotaon command enables quotas for a specified file system, or for all file systems with quotas (as indicated in the /etc/filesystems file) when used with the -a flag.
  7. Use the quotacheck command to check the consistency of the quota files against actual disk usage.
    Note: It is recommended that you do this each time you first enable quotas on a file system and after you reboot the system.

    To enable this check and to turn on quotas during system startup, add the following lines at the end of the /etc/rc file:

    echo " Enabling filesystem quotas "
    /usr/sbin/quotacheck -a 
    /usr/sbin/quotaon -a 

[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]