3    Managing Quotas

You can activate quotas to track and control the amount of physical storage that each user, group, or fileset consumes. You must have root user privilege to set and edit quotas. Quota limits never restrict the root user; they only apply to non-root users.

This chapter discusses the following topics:

3.1    Introducing Quotas

The AdvFS quota system is compatible with the quotas of UFS. However, it differs in two ways:

The AdvFS file system creates quota files to track quotas, grace periods, and fileset usage. Quota files are maintained within the fileset but, unlike UFS, the user cannot delete or create them. Quota files are present in the fileset even if quota limits have not been established.

You can set quota values on the amount of disk storage and on the number of files. In addition, you can set two types of quotas:

Quota files and fileset quotas are saved when the root user specifies a complete backup on a local system. (See Chapter 4 for a description of backup procedures.)

3.1.1    Quota Limits

Limits are set on disk usage (number of blocks) or on number of files (inodes) or both. Table 3-1 shows the size limits for both types of quota values.

Table 3-1:  Quota Size Limits

  User and Group Quotas Fileset Quotas
Disk Usage 8 billion terabytes* 4 billion terabytes
Number of Files 4 billion 4 billion

* Prior to Version 5.0 of the operating system, the disk usage limit for user and group quotas was two terabytes. If your domain was created with an operating system version earlier than Version 5.0, and if you are now running Version 5.0 or later operating system, you must upgrade your domain if you want to take advantage of the new limits. (See Section 2.3.3.4 for more information.)

All quotas can have a hard limit and soft limit. A hard limit cannot be exceeded. No more space can be allocated or files created. A soft limit permits a period of time (see Section 3.1.2) during which the limit can be exceeded as long as the hard limit has not been exceeded.

The root user can set or change hard and soft limits at any time and the changes take effect immediately on filesets where quotas are active. Mounting or unmounting filesets has no effect on the limits. Hard and soft limits can be set for users, for groups, and for filesets. The default is no quota limit. You can also do the following:

Quota limits remain in effect until changed by the root user.

See Section 6.4.5 for directions if you need to write beyond your quota limits.

3.1.2    Grace Period

Associated with each soft limit is a grace period. The grace period is the amount of time during which the soft limit can be exceeded. This time limit stays in effect until the usage goes below the soft limit quota value.

When the grace period expires, the user or the group cannot create new files or allocate more disk space until enough files are deleted to fall below the soft limit. Updating existing files can cause loss of data.

The timer for the grace period starts when the user exceeds the soft limit. The grace period is turned off and reset each time usage drops below the soft limit. If you change the grace period after the user has exceeded the soft limit, the old grace period stays in effect until usage drops below the old limit.

You can set grace periods for the following:

AdvFS sets a default grace period of 7 days. You can specify the grace period in days, hours, minutes, or seconds. This period can be changed. Setting the grace period to 0 days imposes the default grace period. Setting the grace period to 1 second turns off the grace period.

3.1.3    Summarizing Quota Characteristics

Table 3-2 compares user and group quotas with fileset quotas.

Table 3-2:  Comparing User and Group Quotas with Fileset Quotas

User and Group Fileset
Quota files In files named quota.user and quota.group (Section 3.2.1) Part of fileset metadata; not visible
Setting quota limits Change the mount options in the /etc/fstab file, mount the fileset, and run the edquota command (Section 3.2.2) Run the chfsets command (Section 3.3.2)
Setting grace period Use the edquota command with the -ut or -gt option (Section 3.2.2) Same as group grace period (Section 3.3.2)
Enabling quotas Run the quotaon command or, for quota enforcement at reboot, use the rcmgr command (Section 3.2.4 and Section 3.2.5) Setting quota limits turns them on (Section 3.3.4)
Disabling quotas Use the quotaoff command or remove QUOTA_CONFIG="yes" from the /etc/rc.config.common file (Section 3.2.6) Use the chfsets command to set quota limits to 0 (Section 3.3.5)
Checking quota limits Use the edquota command with -u or -g option Use the chfsets or showfsets command

3.2    User and Group Quotas

The following sections describe quota files and how quotas and grace periods are set for users and groups.

3.2.1    User and Group Quota Files

The AdvFS file system keeps user and group quota information in the root directory of the fileset in the quota.user and quota.group files. These files are created when the fileset is created. They are indexed by user ID and group ID and cannot be deleted although quotas need not be enforced. Each quota file entry contains the following information:

Quota files are sparse files (Section 1.3.3); that is, there are holes in the file where no user IDs or group IDs fall. If you execute the ls -l command to view the space spanned by the quota.user or the quota.group file, you will not see the actual disk usage. For example, to view the quota.user file, enter:

# ls -l quota.user
-rw-r-----  1 root     operator  294912 Jul 20 08:50 quota.user

Use the ls -s command or the du -k command to display how many 1K byte blocks the file actually uses. For example, to view the quota.user file, enter:

# ls -s quota.user 
16   quota.user

# du -k quota.user 
16         quota.user

3.2.2    Setting User and Group Quotas and Grace Periods

You are not required to set both user and group quotas. If you specify a group quota, it applies to all users belonging to that group. If you specify a user quota that is larger than the group quota, it is ignored because the group quota takes effect before the user quota is reached.

Use the edquota command to set the quotas for users and groups and use it again to change the grace period. For each fileset, only one grace period can be set for all users and one grace period can be set for all groups. However, you do not have to set the same grace period for the number of blocks and for the number of files. The group grace period you set is also entered as the fileset grace period. (See Section 3.3.2.2 for more information.)

Follow these general steps to set user and group quotas and grace periods:

  1. Add quota file mount-point options (userquota, groupquota) to the /etc/fstab file (Section 2.4.1) and mount the fileset if it is not mounted.

  2. Enter the edquota command with the appropriate options to set user or group quotas or the grace period. The editor specified by the EDITOR environment variable displays an ASCII representation of the quota file. If the EDITOR environment variable is not set, the vi editor is used. Only filesets for which quotas can be set will be visible. If a fileset is missing, repeat step 1.

  3. When the user or group quota information is displayed, change the numbers shown in the hard and soft limit fields as needed. Then, exit the editor, saving the changes.

  4. To set user or group grace periods, enter the edquota command with the - ut option for user or the -gt option for group. An ASCII file that can be edited is displayed.

  5. When the grace period information is displayed, change the numbers shown for the grace period. Then, exit the editor, saving the changes.

For more information on setting quotas and grace periods, see edquota(8).

The quota limits you set for a fileset do not become effective until you activate them by using the quotaon command or at system start-up. (See Section 3.2.4 and Section 3.2.5 for more information.) If you are changing quota limits and quotas are already enforced for a fileset, the new limits become effective immediately.

Once you have set quotas for a single user, you can use the edquota command with the -p option, which allows that user's entry to serve as a prototype to be applied to other users that you specify. (See Section 3.2.3 for instructions.) If you do not use the -p option and you enter the edquota command with more than one user name, an editor window is generated for each user specified.

3.2.2.1    Setting User Quotas

The following example sets quotas for the user user5:

  1. If they do not already exist, add quota mount-point options to filesets in the /etc/fstab file (Section 2.4.1) that you want to set quotas for and mount the filesets that are not mounted.

    domain_1#geb1  /geb1  advfs rw,userquota,groupquota 0 2
    domain_2#geb3  /geb3  advfs rw,userquota,groupquota 0 2
    domain_4#geb4  /geb4  advfs rw,userquota,groupquota 0 2
    

  2. Enter the edquota command with the -u option followed by the user name to display the quota-setting file. If a fileset is missing from the edquota output, repeat step 1.

    # edquota -u user5
     Quotas for user user5: 
     /geb1: blocks in use: 0, limits (soft = 0, hard = 0)
            inodes in use: 0, limits (soft = 0, hard = 0)
     /geb3: blocks in use: 0, limits (soft = 0, hard = 0)
            inodes in use: 0, limits (soft = 0, hard = 0)
     /geb4: blocks in use: 0, limits (soft = 0, hard = 0)
            inodes in use: 0, limits (soft = 0, hard = 0) 
    

    The values for blocks in use and inodes in use are the number of 1K byte blocks and the number of files currently in use for each fileset. You cannot change them. In this example, the filesets are newly created. Soft and hard limits of 0 (zero) indicate that no limits have been set.

  3. Change the numbers shown in the soft and hard fields to set limits for the user you specified. If you specified more than one user name, the values affect all users named.

     /geb1: blocks in use: 0, limits (soft = 0, hard = 0)
            inodes in use: 0, limits (soft = 0, hard = 0)
     /geb3: blocks in use: 0, limits (soft=5000, hard=10000)
            inodes in use: 0  limits (soft= 100, hard=  200)
     /geb4: blocks in use: 0, limits (soft = 0, hard = 0)
            inodes in use: 0, limits (soft = 0, hard = 0) 
    

  4. Exit the editor, saving the changes.

If quotas are already activated for fileset geb3, the new limits become effective immediately. If quotas are not yet enforced for the fileset, the limits become effective as soon as quotas are enforced. (See Section 3.2.5 for a discussion of activating quotas manually.)

If both user and group quotas are set, the lower of the two is enforced.

3.2.2.2    Setting the User Grace Period

When you impose soft limits for a fileset, you can set a grace period for that fileset. If you do not specify a grace period, the grace period remains at the AdvFS default of 7 days. To turn off the grace period, set it to 1 second. You can set different grace periods for the number of blocks and for the number of files. If the group grace period is less than the user grace period, the user is limited by the group grace period.

The following procedure sets the grace period for all users of fileset geb3:

  1. If they do not already exist, add quota mount-point options to filesets in the /etc/fstab file (Section 2.4.1) that you want to set quotas for and mount the filesets that are not mounted.

    domain_1#geb1  /geb1  advfs rw,userquota,groupquota 0 2
    domain_2#geb3  /geb3  advfs rw,userquota,groupquota 0 2
    domain_4#geb4  /geb4  advfs rw,userquota,groupquota 0 2
    

  2. Enter the edquota command with the -ut option to display the grace period-setting file. If a fileset is missing from the edquota output, repeat step 1.

    # edquota -ut 
    Time units may be: days, hours, minutes, or seconds 
    Grace period before enforcing soft limits for users: 
    /geb1: block grace period: 7 days, file grace period: 7 days 
    /geb3: block grace period: 7 days, file grace period: 7 days 
    /geb4: block grace period: 7 days, file grace period: 7 days
    

  3. Change the numbers shown in the block grace period and file grace period fields to set the user grace period for the geb3 fileset.

    Time units may be: days, hours, minutes, or seconds 
    Grace period before enforcing soft limits for users: 
    /geb1: block grace period: 7 days, file grace period:7 days
    /geb3: block grace period: 2 days, file grace period:3 days
    /geb4: block grace period: 7 days, file grace period:7 days
    

  4. Exit the editor, saving the changes.

If quotas are already activated for the fileset geb3, the new grace period becomes effective immediately. If a user has already exceeded the soft limit, the new grace period becomes effective when the usage drops below the soft limit. If quotas are not yet enforced for the fileset, the grace period becomes effective as soon as quotas are activated. (See Section 3.2.5 for a discussion of activating quotas manually.)

3.2.2.3    Setting Group Quotas

The following procedure sets quotas on geb3 for the group rsgusers:

  1. If they do not already exist, add quota mount-point options to filesets in the /etc/fstab file (Section 2.4.1) that you want to set quotas for and mount the filesets that are not mounted.

    domain_1#geb1  /geb1  advfs rw,userquota,groupquota 0 2
    domain_2#geb3  /geb3  advfs rw,userquota,groupquota 0 2
    domain_4#geb4  /geb4  advfs rw,userquota,groupquota 0 2
    

  2. Enter the edquota command with the -g option. If you specify more than one group name, the edits affect all groups named. If a fileset is missing from the edquota output, repeat step 1.

    # edquota -g rsgusers
    Quotas for group rsgusers: 
    /geb1: blocks in use: 0, limits (soft=0, hard=0)
           inodes in use: 0, limits (soft=0, hard=0)
    /geb3: blocks in use: 0, limits (soft=0, hard=0)
           inodes in use: 0, limits (soft=0, hard=0)
    /geb4: blocks in use: 0, limits (soft=0, hard=0)
           inodes in use: 0, limits (soft=0, hard=0)
    

    The values for blocks in use and inodes in use are the current number of 1K byte blocks in use and the number of files for each fileset. You cannot change them. Soft and hard limits of 0 (zero) indicate that no limits have been set.

  3. Change the numbers shown in the soft and hard fields to set limits for the group you specified.

     /geb1: blocks in use: 0, limits (soft=0, hard=0)
            inodes in use: 0, limits (soft=0, hard=0)
     /geb3: blocks in use:0, limits(soft=60000, hard=80000)
            inodes in use:0, limits(soft= 6000, hard= 8000)
     /geb4: blocks in use: 0, limits (soft=0, hard=0)
            inodes in use: 0, limits (soft=0, hard=0)
    

  4. Exit the editor, saving the changes.

If quotas are already activated for fileset geb3, these limits become effective immediately. If quotas are not yet enforced for geb3, these limits become effective as soon as quotas are activated. (See Section 3.2.5 for a discussion of activating quotas manually.) If both user and group quotas are set, the lower of the two is enforced.

3.2.2.4    Setting the Group Grace Period

When you impose soft limits, you can set one grace period per fileset for all groups. The group grace period is the same as the fileset grace period. (See Section 3.3.2.2.) If you do not specify a grace period, the grace period remains the AdvFS default of 7 days. To turn off the grace period, set it to 1 second. You can set different grace periods for the number of blocks and for the number of files. The group grace period takes precedence over all user grace periods.

The following procedure sets the grace period for all groups for fileset geb3:

  1. If they do not already exist, add quota mount-point options to filesets in the /etc/fstab file (Section 2.4.1) that you want to set quotas for and mount the filesets that are not mounted.

    domain_1#geb1  /geb1  advfs rw,userquota,groupquota 0 2
    domain_2#geb3  /geb3  advfs rw,userquota,groupquota 0 2
    domain_4#geb4  /geb4  advfs rw,userquota,groupquota 0 2
    

  2. Enter the edquota command with the -gt option to display the grace period-setting file. If a fileset is missing from the edquota output, repeat step 1.

    # edquota -gt 
    Time units may be: days, hours, minutes, or seconds 
    Grace period before enforcing soft limits for groups: 
    /geb1: block grace period: 7 days, file grace period:7 days 
    /geb3: block grace period: 7 days, file grace period:7 days 
    /geb4: block grace period: 7 days, file grace period:7 days 
    

  3. Change the numbers shown in the block grace period and file grace period fields to set the group grace period for the geb3 fileset.

    Time units may be: days, hours, minutes, or seconds 
    Grace period before enforcing soft limits for groups: 
    /geb1: block grace period: 7 days, file grace period:7 days
    /geb3: block grace period:12hours, file grace period:5 days
    /geb4: block grace period: 7 days, file grace period:7 days 
    

  4. Exit the editor, saving the changes.

If quotas have already been activated, this grace period becomes effective immediately unless a group has already exceeded the soft limit for geb3. In that case, the new grace period becomes effective for that group when the group usage drops below the soft limit. If quotas are not yet enforced, the group grace period becomes effective as soon as they are activated. (See Section 3.2.5 for a discussion of activating quotas manually.)

3.2.2.5    Setting a Temporary Grace Period

You can limit the life span of files in a fileset. If you set a temporary grace period, users can allocate files without limit during the time specified. After that time, no more files can be allocated until all files that were created during the grace period are removed. Setting a temporary grace period might be useful for situations where files are needed for a short time.

To set a temporary grace period, enter the edquota command with the -t option and set the soft limit for the number of blocks or inodes to 1 and the hard limit for the number of blocks or inodes to 0.

3.2.3    Setting User and Group Quotas for Multiple Users and Groups

You can modify quotas for a list of users or groups without accessing and entering values for each one individually. You do not have to set multiple grace periods because, for each user or group quota, one grace period per fileset applies to all users or to all groups.

To set up all users to have the same quota, do the following:

  1. Use the edquota command with the -u or the -g option to establish quotas for a single user or for a group.

  2. Use the edquota command with the -p option to apply the quotas set up for the first user to the others.

See edquota(8) for more information.

3.2.3.1    Setting Quotas for Multiple Users

The following procedure sets up prototype user quotas that are then used to modify the quotas for other users:

  1. Set quotas for one user, user5 as described in Section 3.2.2.1.

    # edquota -u user5
    Quotas for user user5: 
    /geb1:blocks in use:0, limits(soft=    0,hard=     0)
          inodes in use:0, limits(soft=    0,hard=     0)
    /geb3:blocks in use:1 ,limits(soft= 5000,hard= 10000)
          inodes in use:4, limits(soft=  100,hard=   200)
    /geb4:blocks in use:2, limits(soft=    0,hard=     0)
          inodes in use:1, limits(soft=    0,hard=     0)
    

  2. To create quotas for new users user7, user8, and user9, use the quotas from user user5 as a prototype.

    # edquota -p user5 -u user7 user8 user9 
    

  3. To verify that the quotas were set, run the edquota command for user7.

    # edquota -u user7 
    Quotas for user user7: 
    /geb1:blocks in use:0, limits(soft=    0,hard=     0)
          inodes in use:0, limits(soft=    0,hard=     0)
    /geb3:blocks in use:1 ,limits(soft= 5000,hard= 10000)
          inodes in use:4, limits(soft=  100,hard=   200)
    /geb4:blocks in use:2, limits(soft=    0,hard=     0)
          inodes in use:1, limits(soft=    0,hard=     0)
    

3.2.3.2    Setting Quotas for Multiple Groups

The following procedure sets up prototype group quotas that are then used to modify the quotas for another group:

  1. Set quotas for the group rsgusers as described in Section 3.2.2.3:

    # edquota -g rsgusers
    Quotas for group rsgusers: 
    /geb1:blocks in use:0, limits(soft=     0,hard=     0)
          inodes in use:0, limits(soft=     0,hard=     0)
    /geb3:blocks in use:0, limits(soft= 60000,hard=80000)
          inodes in use:0, limits(soft=  6000,hard= 8000)
    /geb4:blocks in use:0, limits(soft=     0,hard=     0)
          inodes in use:0, limits(soft=     0,hard=     0)
    

  2. To create quotas for a new group, rsgstudents, use the quotas from group rsgusers as a prototype:

    # edquota -p rsgusers -g rsgstudents
    

  3. To verify that the quotas were set, run the edquota command for rsgstudents:

    # edquota -g rsgstudents 
    Quotas for group rsgstudents: 
    /geb1:blocks in use:0, limits(soft=     0,hard=     0)
          inodes in use:0, limits(soft=     0,hard=     0)
    /geb3:blocks in use:0, limits(soft= 60000,hard= 80000)
          inodes in use:0, limits(soft=  6000,hard=  8000)
    /geb4:blocks in use:0, limits(soft=     0,hard=     0)
          inodes in use:0, limits(soft=     0,hard=     0)
    

3.2.4    Activating User and Group Quotas at System Start-Up

Follow these steps to start user and group quota enforcement automatically during system initialization:

  1. Edit the /etc/fstab file entry to add quota file mount-point options. See Section 2.4.1 for more information about mount-point options.

  2. Use the rcmgr command to add the QUOTA_CONFIG option to the /etc/rc.config.common file.

    /usr/sbin/rcmgr -c set QUOTA_CONFIG "yes"

    This entry causes the /sbin/init.d quota script to run the quotaon command for file systems where the userquota or groupquota options are specified in the /etc/fstab file. Quota enforcement is activated for the mounted fileset the next time and every time you reboot.

Note

If you unmount a fileset when quota enforcement is active, you must explicitly reactivate quota enforcement by using the quotaon command when you remount the fileset. This must be done even if there is a QUOTA_CONFIG="yes" entry in the /etc/rc.config.common file.

Setting the QUOTA_CONFIG option to "yes" also causes the quotacheck command, which checks file system quota consistency, to run for UFS file systems that have quota options specified in the /etc/fstab file. By default, the quotacheck command is not run for AdvFS file systems because the AdvFS metadata transaction logging keeps storage allocations and quotas synchronized.

To run the quotacheck command at start-up for AdvFS file systems with quota options in the /etc/fstab file, execute the rcmgr command to add the following option to the /etc/rc.config.common file:

/usr/sbin/rcmgr -c set QUOTACHECK_CONFIG -a

To restore the default UFS-only behavior for the quotacheck command, change to the following:

/usr/sbin/rcmgr -c set QUOTACHECK_CONFIG ""

3.2.5    Activating User and Group Quotas Manually

After you have added userquota and groupquota entries to the /etc/fstab file for your mounted filesets and have run the edquota command to set limits and grace period, run the quotaon command to activate quotas.

If your system is set up to initialize quotas at system start-up (Section 3.2.4), you do not need to run the quotaon command again unless you have unmounted your fileset. If your system is set up without quota enforcement (Section 3.2.6), you must run the quotaon command to start enforcement each time you reboot.

The following example activates quotas for the filesets for which quota values were set in the previous sections:

# quotaon -av
/geb1:  group quotas turned on 
/geb1:  user quotas turned on
/geb3:  group quotas turned on
/geb3:  user quotas turned on
/geb4:  group quotas turned on
/geb4:  user quotas turned on 

By default, both user and group quotas are affected by the quotaon command. You can choose to activate quotas either for users (with the -u option) or for groups (with the -g option). You can also specify the filesets for which user or group quotas are enforced. See quotaon(8) for more information.

3.2.6    Deactivating User and Group Quotas

You can turn off quota enforcement either temporarily or permanently. You can obtain file and disk space usage information regardless of whether you are enforcing quotas.

The quotaoff command turns off quota enforcement until the quotaon command is run again either manually or through system initialization that turns quotas on. You can choose to deactivate quotas either for users (with the -u option) or for groups (with the -g option). You can also specify the filesets for which user or group quotas are enforced. See quotaoff(8) for more information.

The umount command turns off quotas before it unmounts a fileset. You cannot turn on quotas for an unmounted fileset. If you remount the fileset, you must run the quotaon command to enforce user and group quotas for the fileset.

If you want to permanently turn off quotas for a user or group, do the following:

  1. Run the quotaoff command to prevent quotas from being enforced for the fileset.

  2. Enter the edquota command and set quota limits to 0 (zero).

  3. Remove the userquota and groupquota entries for the fileset in the /etc/fstab file.

3.3    Fileset Quotas

The following sections describe fileset quota files and how quotas and grace periods are set for filesets using the command line. For information on setting fileset quotas using the AdvFS GUI, see Appendix E.

3.3.1    Fileset Quota Files

AdvFS keeps fileset soft and hard limits in the structural information associated with the fileset. You do not have direct access to this file. It contains the same type of information that the user and group quota files contain: hard and soft limits for the number of blocks and hard and soft limits for the number of files. For a given fileset, the fileset grace period is the same as the group grace period.

3.3.2    Setting Fileset Quotas and Grace Periods

Fileset quotas limit the number of files or the amount of disk space a fileset can use. You can set both soft and hard limits. If fileset quotas are not imposed, any fileset has access to all of the available disk space in the domain. The fileset quotas are set by using the chfsets command. If fileset quotas are set, they are enforced whenever you mount the fileset.

Fileset quotas have a grace period. (See Section 3.3.2.2 for more information.) If you do not set a grace period, the grace period remains at the AdvFS default grace period of 7 days. To turn off the grace period, set it to 1 second.

Use the chfsets command to define fileset quota values. You can use the following options:

-F Sets a soft limit for the number of files
-f Sets a hard limit for the number of files
-B Sets a soft limit for block usage
-b Sets a hard limit for block usage

The command displays both the old and new limits.

3.3.2.1    Setting Fileset Quotas

The following procedure sets fileset quotas for the student_files fileset in the year1 domain. Unlike other quota commands, the showfsets command displays block usage in 512-byte blocks. If you want to display kilobyte values, use the -k option.

  1. To display existing fileset quotas, execute the showfsets command.

    # showfsets -k year1 student_files 
    student_files
       Id           : 2feff762.00034e3f.1.8001
       Clone is     : stufiles_clone
       Files        :        7,  SLim=    0,  HLim=      0
       Blocks (1k)  :      118,  SLim=    0,  HLim=      0
       Quota Status : user=on  group=on
       Object Safety: off
       Fragging     : on
       DMAPI        : off
    

    Here SLim is the soft limit and HLim is the hard limit for the number of files and the current block usage.

  2. Use the chfsets command to set the quotas.

    # chfsets -F 1000 -f 2000 -B 25000 -b 50000 year1 student_files
    

  3. To verify the new fileset quotas, rerun the showfsets command.

    # showfsets -k year1 student_files
    student_files
       Id           : 2feff762.00034e3f.1.8001
       Clone is     : stufiles_clone
       Files        :      7,  SLim=  1000,  HLim=   2000
       Blocks (1k)  :    118,  SLim= 25000,  HLim=  50000
       Quota Status : user=on  group=on
       Object Safety: off
       Fragging     : on
       DMAPI        : off
    

3.3.2.2    Setting the Grace Period

The fileset grace period is the same as the group grace period and cannot be modified independently. Therefore, if you use the edquota command with the -gt option to change the grace period for which a group can exceed its soft limits, you also change this grace period for the fileset. See Section 3.2.2.4 for an explanation of setting the group (and fileset) grace period.

3.3.3    Setting Fileset Quotas for Multiple Filesets

You can set quota limits for more than one fileset in a domain by listing more than one fileset name when you run the chfsets command.

For example, to change the hard limits for the data and data2 filesets in domain_2, enter the names of both filesets after the chfsets command:

# chfsets -b 1000 -f 200 domain_2 data data2

3.3.4    Activating Fileset Quotas

Running the chfsets command immediately activates fileset quotas. No further steps are needed. Fileset quotas are in effect whenever you mount the fileset.

3.3.5    Deactivating Fileset Quotas

You can deactivate quota enforcement on a fileset either temporarily or permanently by running the chfsets command with the hard and soft limits set to 0 (zero). You can obtain file and disk space usage information regardless of whether you are enforcing quotas.

3.4    Verifying Fileset and Disk Space Usage

You can monitor file and disk space usage by using commands such as df, showfdmn, /sbin/advfs/vdf, and showfsets. For general information on displaying disk usage or if your disk usage information appears to be corrupt, see Section 6.4.1. Commands that display the address range of a file, such as ls, make a quota file, which is sparse, look larger than it actually is.

3.4.1    Examining User and Group Quotas

If you are enforcing user and group quotas, you can periodically verify your quota setup. If you are not the root user, you can display information only for your own files. The root user can display all user and all group quota information for all filesets. All disk quota values are displayed in 1K byte blocks.

The commands shown in Table 3-3 are useful for examining disk space and file usage for filesets for which user and group quotas are enforced.

Table 3-3:  User and Group Usage Commands

Command Description
ncheck Prints the tag and full pathname for each file in the fileset
quot Summarizes fileset ownership
quota Displays disk usage and limits by user or group
quotacheck Checks quota consistency for a fileset
repquota Summarizes user and group quotas for a fileset

3.4.1.1    Printing the Tag and Full Pathname for Each File

The ncheck command lists files by tag (equivalent to inode) number. By piping the output to the sort command, you can use the sorted output as input for the quot command to list all files and their owners. Use the following format to generate the listing:

ncheck domain#fileset |sort +0n| quot -n domain#fileset

3.4.1.2    Summarizing Fileset Ownership

The quot command displays block usage and the number of files in the mounted filesets that each user owns. If you do not specify a fileset, the command processes all filesets in the /etc/fstab file that include the ro, rw, and rq mount options.

The quot command entered with no options displays only blocks for each user.

# quot domain_1#set_1 
domain_1#set_1: 
34128    root
  816    user5 

The quot command with the -f option displays both the size and number of files for each user.

# quot -f domain_1#set_1
domain_1#set_1: 
34128     125   root
  816       9   user5

3.4.1.3    Displaying Disk Usage and Limits

The quota command displays the block usage, the number of files, and the quotas for a user or group for mounted filesets that have userquota and groupquota entries in the /etc/fstab file. You can choose to display quota information for users or groups, for all filesets with usage over quota, or for all mounted filesets regardless of whether quotas are enforced.

The quota command displays the block usage of the fileset, soft limit (quota), hard limit (limit), grace period, and the number of files used for each user. An asterisk (*) in a column indicates that a soft limit has been exceeded. The grace period is not displayed unless the soft limit has been exceeded. Execute the edquota command to view existing quotas.

The following example displays quota information for the user runner1:

# quota -u runner1 
Disk quotas for user runner1 (uid 446): 
  Filesystem  blocks  quota   limit grace files quota limit  grace
      /           60    100     150           3    10    20
      /usr      5071*  5000   10000 24:40     2    20    40
      /mile1     816  20000   30000           9   350   500
      /mile2   22032  50000  200000           2  2000  4000 
      /mile3    2344  10000   15000         370  1000  2000
      /mile4   18023* 10000   20000 7days     3   100   150
      /mile5   32012* 20000   50000 7days     0  2000  3000 

The following example displays quota information for the group kingco:

# quota -g kingco
Disk quotas for group kingco (gid 15): 
  Filesystem  blocks  quota   limit grace files quota limit  grace 
      /          118    200     300           2    20    40
      /usr     13184* 10000   20000 7days     2    40    80 
      /mile1   36136 100000  200000         124 10000 20000
      /mile2   44064 200000  400000           4  2000  4000 
      /mile3    3587  30000   60000         628  3000  5000
      /mile4   51071 150000  300000           6  1050  1800
      /mile5   61044 100000  200000           3 10000 20000

3.4.1.4    Verifying User and Group Quota Consistency

The quotacheck command verifies that the actual blocks used and the number of files are consistent with the established limits. It examines user and group files, builds a table of current disk usage, and compares this table with that stored in the disk quota file.

The quotacheck command requires that filesets be mounted. Use the -v option (verbose) to display inconsistencies found and procedures performed during the checking process.

By default both user and group quotas are checked, but you can specify either by using the -u option for user or the -g option for group.

The following example displays a verbose check of the fileset set_1, which has no inconsistencies.

# quotacheck -v domain_1#set_1
 *** Checking user and group quotas for domain_1#set_1 (/set_1)

The following example checks all filesets that have quotas defined in the /etc/fstab file. In this display, inodes is the number of files and blocks is the block usage. Here the quotacheck command fixes inconsistencies in the /usr directory.

# quotacheck -va 
*** Checking user and group quotas for /dev/rdisk/dsk0g (/usr) 
*** Checking user and group quotas for domain_1#set_1 (/set_1) 
/usr:root    fixed group quota: inodes   3057 ->   3022 
                                blocks 100616 -> 123440
/usr:system  fixed group quota: inodes   2483 ->   2488 
                                blocks  91721 -> 114568 
/usr:adm     fixed group quota: inodes    280 ->    240 
                                blocks    487 ->    464

3.4.1.5    Summarizing User and Group Quotas by Fileset

The repquota command displays the actual disk usage and quotas for the specified filesets. The fileset must be mounted and have a quota entry in the /etc/fstab file to be included in the summary. By default user quotas are reported, but you can specify which quotas are reported by using the -u option for user or the -g option for group. If you specify the -a option, both the user and group quotas are displayed.

For each user or group, the repquota command lists the current number of files, the amount of space used, and the quota limits established by the edquota command.

The following example summarizes quotas for a single fileset mounted on /set_1:

# repquota -v /set_1
*** Report for user quotas on /set_1 (domain_1#set_1)
                    Block limits              File limits  
User       used    soft    hard  grace  used  soft  hard  grace  
root  --  34088       0       0          123     0     0  
user5 --    816   20000   30000            9   350   500  

The following example displays user and group quota information for all mounted filesets that have quotas defined in the /etc/fstab file. This example contains both UFS and AdvFS files.

# repquota -va 
*** Report for group quotas on /usr (/dev/disk/dsk0g)
                    Block limits              File limits
Group         used  soft  hard  grace   used  soft  hard  grace
system   -- 114568     0     0          2488     0     0
daemon   --    144     0     0             1     0     0
uucp     --    801     0     0             8     0     0
mem      --   1096     0     0            10     0     0
bin      -- 108989     0     0          3219     0     0
mail     --    209     0     0             2     0     0 
terminal --     56     0     0             2     0     0 
adm      --    464     0     0           240     0     0
operator --    392     0     0             3     0     0  
211      --   6937     0     0            33     0     0
*** Report for user quotas on /usr (/dev/disk/dsk0g)
                     Block limits              File limits    
User          used  soft  hard  grace   used  soft  hard  grace
root     -- 123440     0     0          3022     0     0    
bi       -- 102534     0     0          2940     0     0    
uucp     --    729     0     0             7     0     0    
adm      --      1     0     0             1     0     0    
user5    --     15    18    24             1     0     0    
kraetsch --   6937     0     0            35     0     0 
*** Report for group quotas on /set_1 (domain_1#set_1)
                     Block limits              File limits    
Group         used  soft  hard  grace   used  soft  hard  grace
system   --  22816     0     0            50     0     0    
daemon   --  12088     0     0            82     0     0
*** Report for user quotas on /set_1 (domain_1#set_1)
                     Block limits              File limits    
User          used  soft  hard  grace   used  soft  hard  grace
root     --  34088     0     0           123     0     0    
user5    --    816 20000 30000             9   350   500 
*** Report for group quotas on /set_3 (domain_2#set_3)
                     Block limits              File limits    
Group        used   soft  hard  grace   used  soft  hard  grace
system   --  1593      0     0             6     0     0
*** Report for user quotas on /set_3 (domain_2#set_3)
                     Block limits              File limits    
User         used   soft  hard  grace   used  soft  hard  grace
root     --  1593      0     0             6     0     0

3.4.2    Examining Fileset Quotas

Fileset quota information is accessed with the general commands used to examine filesets. The commands shown in Table 3-4 are useful for this task.

Table 3-4:  User and Group Usage Commands

Command Description
df Displays disk usage by fileset
showfsets Displays fileset quota limits when the -q option is specified
showfdmn Displays domain information
/sbin/advfs/vdf Reformats output from other fileset usage commands

3.4.2.1    Displaying Fileset Space

The df command displays the available disk space and the disk space used for a fileset. The command calculates capacity using the lower (hard or soft) limit for the amount of space available:

Output of the df command does not include space used by metadata or quota files.

AdvFS calculates each fileset capacity independently. If the domain has multiple filesets, all unused space is available for each fileset unless fileset quotas limit the space. As a result, the total capacity of all filesets in the domain can appear to be greater than 100%. The following example displays the amount of space available for fileset_1:

# df /fileset_1
Filesystem        512-blocks  Used Avail  Capacity  Mounted on
domain_1#fileset_1      1500  1750     0      117%  /fileset_1 

Because the usage is over the limit, the capacity is determined by the actual space used (1750/1500) and appears as more than 100%. If usage is not over the limit, capacity is calculated as (used)/(used + available).

In the following example, the filesets jan and mar each can use all of the available disk space from the volumes in the credit domain:

# df
  Filesystem   512-blocks    Used    Avail Capacity  Mounted on
credit#jan        2000000  390820    98864      80%  /jan
credit#mar        2000000  271580    98864      73%  /mar 
 

3.4.2.2    Displaying Fileset Limits

Use the showfsets command with the -q option to display file usage, hard and soft limits, and grace period for the filesets in the specified domain. The command displays the block usage, the block usage limit, the number of files, and the file limit. The correct information is displayed only if the fileset is mounted.

The following example displays fileset information for the domain domain_1:

# showfsets -q domain_1
  		     Block (512) Limits	    	File Limits     
Fileset  BF  used soft hard grace  used soft hard grace     
fileset1 +-  1750 1500 2000 11:32    35  300  400

In this example, the plus sign (+) in the BF field indicates that the soft limit for block usage is exceeded. An asterisk (*) would indicate that the hard limit has been reached. The limit for number of files has not been reached.

3.4.2.3    Displaying Domain Space

Use the showfdmn command to obtain domain statistics that you can use to make decisions about filesets and their quotas. The command displays the attributes of a domain and information about each volume in the domain including the total volume size, the total number of free blocks, and the total percentage of volume space currently allocated.

# showfdmn usr_domain
               Id         Date Created LogPgs Version Domain Name
39cbf2d6.0002691e Sun Jan 20 17:01 2002   512       4 usr_domain
 
 Vol  512-Blks    Free % Used Cmode Rblks Wblks Vol Name 
  1L  10605520 7757728    27%    on   256   256 /dev/disk/dsk8d

3.4.2.4    Displaying Domain and Fileset Space

The /sbin/advfs/vdf utility reformats output from the showfdmn, showfsets, and df commands to display information about the disk usage of AdvFS domains and filesets. It clarifies the relationship between a domain's disk usage and its fileset's disk usage.

The utility is subject to the following restrictions:

It is a good idea to run the vdf command on a system that is not active. Because the command executes a sequence of utilities, a system that is actively adding, removing, and modifying files can cause vdf to generate inconsistent output.

You can specify either a domain or a fileset name for the vdf command. If you specify only a fileset name, the output is the same as that of the df command. If you specify a domain, the utility also displays the number of disk blocks used for metadata. If you specify the -l option with either a domain or a fileset, both domain and fileset information is displayed. The domain metadata displayed is the total metadata shared by all filesets in the domain.

The following example displays the summary information for the domain usr_domain:

# /sbin/advfs/vdf usr_domain
Domain     512-blocks   Metadata    Used   Available  Capacity
usr_domain      65536      11219   47549        6768       89%

The following example examines the domain jba that contains two filesets. Each has a quota limit of 60,000 blocks.

# /sbin/advfs/vdf -l jba
 
Domain     512-blocks   Metadata    Used   Available  Capacity
jba            266240       5824   29128      231288       13% 
 
Fileset    QuotaLimit               Used   Available  Capacity
jbfsa           60000              20800       39200       35%
jbfs2a          60000               8328       51672       14% 

The following example displays the domain jbb that contains two filesets with no quota limits. In this case, the total space available to each fileset is the same as the domain total.

# /sbin/advfs/vdf -l jbb
Domain     512-blocks   Metadata    Used   Available  Capacity
jbb            266240       5824   29128      231288       13% 
 
Fileset    QuotaLimit               Used   Available  Capacity
jbfsb               -              20800      231288       35%
jbfs2b              -               8328      231288       14%