System Administration Guide, Volume 2

Setting Up Quotas Task Map

Table 29-2 Setting Up Quotas Task Map

Task 

Description 

For Instructions, Go To ... 

1. Configure a File System for Quotas 

Edit /etc/vfstab so that quotas are activated each time the file system is mounted, and create a quotas file.

"How to Configure File Systems for Quotas"

2. Set Up Quotas for a User 

Use the edquota command to create disk and inode quotas for a single user account.

"How to Set Up Quotas for a User"

3. Set Up Quotas for Multiple Users 

Optional. Use edquota to apply prototype quotas to other user accounts.

"How to Set Up Quotas for Multiple Users"

4. Check for Consistency 

Use the quotacheck command to compare quotas to current disk usage for consistency on one or more file systems.

"How to Check Quota Consistency"

5. Turn Quotas On 

Use the quotaon command to initiate quotas on one or more file systems.

"How to Turn Quotas On"

How to Configure File Systems for Quotas

  1. Become superuser.

  2. Edit the /etc/vfstab file and add rq to the mount options field for each UFS file system that will have quotas.

  3. Change directory to the top of the file system that will have quotas.

  4. Create a file named quotas.


    # touch quotas
    
  5. Change permissions to read/write for root only.


    # chmod 600 quotas
    

Examples--Configuring File Systems for Quotas

The following example from /etc/vfstab shows that the /export/home directory from the system pluto is mounted as an NFS file system on the local system with quotas enabled, signified by the rq entry under the mount options column.


#device           device   mount       FS    fsck   mount   mount
#to mount         to fsck  point       type  pass   at boot options
#
pluto:/export/home -       /export/home nfs    -     yes    rq

The following example line from /etc/vfstab shows that the local /work directory is mounted with quotas enabled, signified by the rq entry under the mount options column.


#device           device            mount  FS   fsck mount   mount
#to mount         to fsck           point  type pass at boot options
#
/dev/dsk/c0t4d0s0 /dev/rdsk/c0t4d0s0 /work ufs  3    yes     rq

How to Set Up Quotas for a User

  1. Become superuser.

  2. Use the quota editor to create a temporary file containing one line of quota information for each mounted UFS file system that has a quotas file in its top-level directory.


    # edquota username
    

    username

    User for whom you want to set up quotas. 

  3. Change the number of 1-Kbyte disk blocks, both soft and hard, and the number of inodes, both soft and hard, from 0 (the default) to the quotas you specify for each file system.

  4. Verify the user's quota by using the quota command.


    # quota -v username
    

    -v

    Display's user's quota information on all mounted file systems where quotas exist. 

    username

    Specifies user name to view quota limits. 

Examples--Setting Up Quotas for a User

The following example shows the contents of the temporary file opened by edquota on a system where /files is the only mounted file system containing a quotas file in its top-level directory.


fs /files blocks (soft = 0, hard = 0) inodes (soft = 0, hard = 0)

The following example shows the same line in the temporary file after quotas have been set up.


fs /files blocks (soft = 50, hard = 60) inodes (soft = 90, hard = 100)

How to Set Up Quotas for Multiple Users

  1. Become superuser.

  2. Use the quota editor to apply the quotas you already established for a prototype user to the additional users you specify.


    # edquota -p prototype-user username ...
    

    prototype-user

    User name of the account for which you have set up quotas. 

    username ...

    Specifies one or more user names of additional accounts. 

Example--Setting Up Prototype Quotas for Multiple Users

The following example applies the quotas established for user bob to users mary and john.


# edquota -p bob mary john

How to Check Quota Consistency


Note -

To ensure accurate disk data, the file systems being checked should be quiescent when you run the quotacheck command manually. The quotacheck command is run automatically when a system is rebooted.


  1. Become superuser.

  2. Run a consistency check on UFS file systems.


    # quotacheck [-v] filesystem 
    

    -v

    (Optional) Identifies the disk quotas for each user on a particular file system.  

    -a

    Checks all file systems with an rq entry in the /etc/vfstab file.

    filesystem

    Specifies a file system to check. 

    See quotacheck(1M) for more information.

Example--Checking Quota Consistency

The following example checks quotas for the /export/home file system on the /dev/rdsk/c0t0d0s7 slice. The /export/home file system is the only file system with an rq entry in the /etc/vfstab file.


# quotacheck -va
*** Checking quotas for /dev/rdsk/c0t0d0s7 (/export/home)

How to Turn Quotas On

  1. Become superuser.

  2. Turn file system quotas on by using the quotaon command.


    # quotaon [-v] -a filesystem ...
    

    -v

    Verbose option. 

    -a

    Turns quotas on for all file systems with an rq entry in the /etc/vfstab file.

    filesystem ...

    Turns quotas on for one or more file systems that you specify. 

Example--Turning Quotas On

The following example turns quotas on for the file systems on the /dev/dsk/c0t4d0s7 and /dev/dsk/c0t3d0s7 slices.


# quotaon -v /dev/dsk/c0t4d0s7 /dev/dsk/c0t3d0s7
/dev/dsk/c0t4d0s7: quotas turned on
/dev/dsk/c0t3d0s7: quotas turned on