2    Managing Quotas

The AdvFS file system allows you to 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; quota limits only apply to nonroot users.

This chapter covers the following:

2.1    Introducing Quotas

The AdvFS quota system is compatible with the quotas of UFS. However, the AdvFS quota system 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.

2.1.1    Quota Limits

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

Table 2-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 2 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 1.6.3).

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 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 and activating or deactivating quotas have 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:

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

See Section 5.8.2 for directions if your activities cause you to run into limits.

2.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. If you allow no grace period, the user can exceed the soft limit only once. 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 limit.

You can set grace periods for:

AdvFS sets a default grace period of 7 days. This period can be changed (see Section 2.2.2 and Section 2.3.2). You can:

2.2    User and Group Quotas

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

2.2.1    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. Each quota file entry contains the following information:

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

# 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 1 KB blocks the file actually uses:

# ls -s quota.user 
16   quota.user

# du -k quota.user 
16         quota.user

To enforce user or group quotas for a fileset, the /etc/fstab file must contain the userquota or the groupquota mount-point options respectively for the fileset:

domain#fileset /mnt advfs rw,userquota,groupquota 0 2

If these options are present, you can use the quotaon command to start enforcing quotas (see Section 2.2.6).

You can relocate the quota.user and quota.group files to subdirectories of the fileset. However, you cannot relocate them to other filesets nor delete them. If you relocate your files, you must update the /etc/fstab file entry to include the path and name of the relocated file(s) in the userquota and groupquota parameters.

For example, to relocate the quota.user file to the d4 subdirectory and rename it nquot, change the /etc/fstab entry to:

dom_1#fset /mnt advfs rw,userquota=/mnt/d4/nquot,groupquota 0 2 

In this example, the group quota file is not moved.

Whether or not you relocate your quota files, you do not need to enforce quotas. See Section 2.2.7 for instruction on deactivating user and group quotas.

2.2.2    Setting 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 has no effect 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. You must mount the fileset before you can set quotas and grace periods. Note that 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 2.3.2.2).

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.

  2. Enter the edquota command with the -u option to set user quotas or the -g option to set group quotas. 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.

  3. When the user or group quota information is displayed, modify the values in the limits 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. Note that the fileset grace period is the same as the group grace period.

  5. When the grace period information is displayed, modify the grace period as desired. Then, exit the editor, saving the changes.

To change the default editor and for more information, see edquota(8).

The quota limits you set for a fileset do not take effect until you activate them by using the quotaon command (see Section 2.2.5 and Section 2.2.6). If you are changing quota limits and quotas have already been activated for a fileset, the new limits become effective immediately.

If you have set quotas for a single user, you can use the edquota -p command, which allows that user's entry to serve as a prototype to be applied to other users that you specify (see Section 2.2.3).

2.2.2.1    Setting User Quotas

The following procedure sets quotas for the user user5:

  1. If they do not already exist, add quota mount-point options to the /etc/fstab file. Note that there can be no spaces in the list of options delimited by commas; that is, from rw through groupquota:

    domain_1#eb1  /eb1  advfs rw,userquota,groupquota 0 2
    domain_2#eb3  /eb3  advfs rw,userquota,groupquota 0 2
    domain_4#eb4  /eb4  advfs rw,userquota,groupquota 0 2
    

  2. Enter the edquota -u command followed by the user name. If you specify more than one user name, the edits affect all users named. The command creates a temporary file with an ASCII representation of the current quotas assigned to the named users and invokes an editor to allow you to modify the file:

    # edquota -u user5
     Quotas for user user5: 
     /eb1: blocks in use: 0, limits (soft = 0, hard = 0)
             inodes in use: 0, limits (soft = 0, hard = 0)
     /eb3: blocks in use: 0, limits (soft = 0, hard = 0)
             inodes in use: 0, limits (soft = 0, hard = 0)
     /eb4: 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 1 KB blocks and the number of files currently in use for each fileset. You cannot change them. Soft and hard limits of 0 (zero) indicate that no limits have been set.

  3. To change user quotas for user5 for fileset eb3, edit the quota.user file. Enter the new limits for disk usage on the blocks line and enter the new limits for the number of files on the inodes line:

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

  4. Exit the editor, saving the changes.

If quotas have already been activated for fileset eb3, the new limits become effective immediately. If quotas are not yet activated for the fileset, the limits become effective as soon as quotas are activated (see Section 2.2.6).

Quotas set for the group to which the user belongs take precedence over quotas set for the user of the fileset.

2.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. 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 a user grace period, the user is limited by the group grace period.

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

  1. Run the edquota -ut command. The command creates a temporary file with an ASCII representation of the current grace period and invokes an editor to allow you to modify the file.

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

  2. To set the user grace period for the number of blocks and for the number of files for eb3, edit the file to change the existing grace period:

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

  3. Exit the editor, saving the changes.

If quotas have already been activated for the fileset eb3, the new grace period becomes effective immediately. If a user has already exceeded the soft limit, the grace period becomes effective when the usage drops below the soft limit. If quotas are not yet activated for the fileset, the grace period becomes effective as soon as quotas are activated (see Section 2.2.6).

2.2.2.3    Setting Group Quotas

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

  1. If they do not already exist, add quota mount-point options to the /etc/fstab file. Note that there can be no spaces in the list of options delimited by commas; that is, from rw through groupquota:

    domain_1#eb1  /eb1  advfs rw,userquota,groupquota 0 2
    domain_2#eb3  /eb3  advfs rw,userquota,groupquota 0 2
    domain_4#eb4  /eb4  advfs rw,userquota,groupquota 0 2
    

  2. Enter the edquota -g command. If you specify more than one group name, the edits affect all groups named. The command creates a temporary file with an ASCII representation of the current quotas assigned to the named groups and invokes an editor to allow you to modify the file.

    # edquota -g rsgusers
    Quotas for group rsgusers: 
    /eb1: blocks in use: 0, limits (soft=0, hard=0)
            inodes in use: 0, limits (soft=0, hard=0)
    /eb3: blocks in use: 0, limits (soft=0, hard=0)
            inodes in use: 0, limits (soft=0, hard=0)
    /eb4: 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 1 KB 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. To change the group quotas for eb3, edit the group.quota file. Enter the new limits for disk usage on the blocks line and enter the new limits for the number of files on the inodes line:

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

  4. Exit the editor, saving the changes.

If quotas have already been activated for fileset eb3, these limits become effective immediately. If quotas are not yet activated for eb3, these limits become effective as soon as quotas are activated (see Section 2.2.6). Quotas set for the group take precedence over quotas set for the individual.

2.2.2.4    Setting the Group Grace Period

When you impose soft limits, you can set one grace period per fileset for all groups. If you do not specify a grace period, the grace period remains the AdvFS default of 7 days. 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 eb3:

  1. Run the edquota -gt command. The command creates a temporary file with an ASCII representation of the current grace period and invokes an editor to allow you to modify the file.

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

  2. To set the group grace period for the number of blocks and for the number of files for eb3, edit the file to change the existing grace period:

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

  3. 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 eb3. 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 activated, the group grace period becomes effective as soon as they are activated (see Section 2.2.6).

2.2.3    Setting Quotas for Multiple Users and Groups

The AdvFS file system allows you to use a single command to modify quotas for a list of users or groups so you do not need to access and enter values for each one individually. Note that 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.

Use the edquota -p command to take existing quota information and establish it as a prototype user or group quota. Then apply the prototype to one or more users or groups.

For example, to set up all student accounts to have the same disk usage quota:

  1. Use the edquota command with the desired limits to establish a set of quotas for a single student.

  2. Use the edquota -p command to apply the quotas set up for the first user to other student accounts.

2.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 (see Section 2.2.2.1):

    #edquota -u user5
    Quotas for user user5: 
    /eb1:blocks in use:0, limits(soft= 20000,hard= 30000)
           inodes in use:0, limits(soft=   350,hard=   500)
    /eb3:blocks in use:1 ,limits(soft= 30000,hard= 40000)
           inodes in use:4, limits(soft=   400,hard=   550)
    /eb4:blocks in use:2, limits(soft= 10000,hard= 20000)
           inodes in use:1, limits(soft=   150,hard=   200)
    /eb5:blocks in use:2, limits(soft=100000,hard=150000)
           inodes in use:1, limits(soft=  5000,hard=  7000)
    

  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: 
    /eb1:blocks in use:0, limits(soft= 20000,hard= 30000)
           inodes in use:0, limits(soft=   350,hard=   500)
    /eb3:blocks in use:0, limits(soft= 30000,hard= 40000)
           inodes in use:0, limits(soft=   400,hard=   550)
    /eb4:blocks in use:0, limits(soft= 10000,hard= 20000)
           inodes in use:0, limits(soft=   150,hard=   200)
    /eb5:blocks in use:0, limits(soft=100000,hard=150000)
           inodes in use:0, limits(soft=  5000,hard=  7000)
    

2.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 (see Section 2.2.2.3):

    # edquota -g rsgusers
    Quotas for group rsgusers: 
    /eb1:blocks in use:0, limits(soft=100000,hard=200000)
           inodes in use:0, limits(soft= 10000,hard= 20000)
    /eb3:blocks in use:0, limits(soft=300000,hard=400000)
           inodes in use:0, limits(soft= 30000,hard= 40000)
    /eb4:blocks in use:0, limits(soft=500000,hard=600000)
           inodes in use:0, limits(soft= 50000,hard= 60000)
    /eb5:blocks in use:0, limits(soft=350000,hard=450000)
           inodes in use:0, limits(soft= 35000,hard= 45000)
    

  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:
    /eb1:blocks in use:0, limits(soft=100000,hard=200000)
           inodes in use:0, limits(soft= 10000,hard= 20000)
    /eb3:blocks in use:0, limits(soft=300000,hard=400000)
           inodes in use:0, limits(soft= 30000,hard= 40000)
    /eb4:blocks in use:0, limits(soft=500000,hard=600000)
           inodes in use:0, limits(soft= 50000,hard= 60000)
    /eb5:blocks in use:0, limits(soft=350000,hard=450000)
           inodes in use:0, limits(soft= 35000,hard= 45000) 
    

2.2.4    Verifying File and Disk Space Usage

Even if you are not enforcing quotas, you can monitor file and disk space usage by using the df, showfdmn, vdf, and showfsets commands. Use the -k option to display information in kilobytes. See the appropriate reference pages for more information.

If you are enforcing quotas, you can periodically verify your quota setup. You can display user and group quota information in a number of ways. 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 1 KB blocks.

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

Table 2-2:  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 fileset quota consistency
repquota Summarizes quotas for a fileset

See the command reference pages for more information.

If your disk usage information appears to be corrupt, see Section 5.1 for instructions on how to correct this.

2.2.4.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

2.2.4.2    Summarizing Fileset Ownership

The quot command displays block usage and the number of files in the fileset 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:

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

The quot -f command displays both blocks and files:

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

2.2.4.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. Users can run this command to look at their own disk space usage. The root user can look at usage for the whole system.

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 activated.

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 means that a soft quota limit has been exceeded. Note that the grace period is not displayed unless the soft limit has been exceeded. Use the edquota command to view complete quota specifications.

The following example displays quota information for the user user5:

# quota -u user5 
Disk quotas for user user5 (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
    /eb1      816  20000   30000           9   350   500
    /eb2    22032  50000  200000           2  2000  4000 
    /eb3     2344  10000   15000         370  1000  2000
    /eb4    18023* 10000   20000 7days     3   100   150
    /eb5    32012* 20000   50000 7days     0  2000  3000 

The following example displays quota information for the group rsgusers:

# quota -g rsgusers
Disk quotas for group rsgusers (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 
    /eb1  36136 100000  200000         124 10000 20000
    /eb2  44064 200000  400000           4  2000  4000 
    /eb3   3587  30000   60000         628  3000  5000
    /eb4  51071 150000  300000           6  1050  1800
    /eb5  61044 100000  200000           3 10000 20000

2.2.4.4    Verifying 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 that displays no inconsistencies:

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

The following example checks all filesets that have quotas defined in the /etc/fstab file. In this example 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 (/eb1) 
/usr: root   fixed: inodes 3057 -> 3022 blocks 100616 -> 123440 
/usr: system fixed: inodes 2483 -> 2488 blocks 91721  -> 114568 
/usr: adm    fixed: inodes 280  ->  240 blocks   487  ->    464

In this display, inodes is the number of files and blocks is the block usage.

2.2.4.5    Summarizing Quotas by Fileset

The repquota command displays the actual disk usage and quotas for the specified filesets. The fileset must 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 prints 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 /eb1:

# repquota -v /eb1 
*** Report for user quotas on /eb1 (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 filesets in the /etc/fstab file that have quotas defined. Note that 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 /eb1 (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 /eb1 (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 /eb3 (domain_2#set_1)
                     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 /eb3 (domain_2#set_1)
                     Block limits              File limits    
User         used   soft  hard  grace   used  soft  hard  grace
root     --  1593      0     0             6     0     0

2.2.5    Activating Quotas at System Start-Up

You can automatically start user and group quota enforcement during system initialization.

  1. Edit the /etc/fstab file entry to change the fourth field to rw,userquota,groupquota.

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

    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.

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 startup for AdvFS file systems with quota options in the /etc/fstab file, use 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 ""

2.2.6    Activating Quotas Manually

If your system is running, enter the quotaon command to activate new quotas for a mounted fileset. To establish new user or group quotas do the following:

  1. Edit the /etc/fstab file entry for your fileset to add userquota and groupquota to the mount point.

  2. Run the edquota command to enter the hard and soft limits and to enter the grace period.

  3. Run the quotaon command to activate the new quotas.

If your system is set up to initialize quotas at system startup (see Section 2.2.5), 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 (see Section 2.2.7), 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
/eb1:  group quotas turned on 
/eb1:  user quotas turned on
/eb3:  group quotas turned on
/eb3:  user quotas turned on
/eb4:  group quotas turned on
/eb4:  user quotas turned on 

By default, both user and group quotas are affected by the quotaon and quotaoff commands. 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 Section 2.3.5 for information on fileset quotas).

2.2.7    Deactivating 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.

The umount command turns off quotas before it unmounts a 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 quotas off for a user or group, use the edquota command to set quota limits to 0 (zero). To prevent quotas from ever being activated for a fileset, run the quotaoff command. Then, remove the userquota and groupquota entries for the fileset in the /etc/fstab file.

2.3    Fileset Quotas

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

2.3.1    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.

2.3.2    Setting 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 activated whenever you mount the fileset.

The fileset grace period is the same as the group grace period (see Section 2.3.2.2). If you do not set a grace period, the grace period remains at the AdvFS default grace period of 7 days.

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.

2.3.2.1    Setting Fileset Quotas

The following procedure sets fileset quotas for the set_1 fileset in the dmn_2 domain. Note that unlike the 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, use the showfsets command:

    # showfsets dmn_2 set_1 
    set_1
       Id           : 2feff762.00034e3f.1.8001
       Clone is     : set_1_clone
       Files        :      7,  SLim=      0,  HLim=        0
       Blocks (512) :    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. Note that the arguments for block usage for the chfsets command are in units of 1 KB, not 512 bytes as displayed by the showfsets command display.

    # chfsets -F 10000 -f 20000 -B 250000 -b 500000 dmn_2 set_1
    

    Here -F sets the soft limit for the number of files, -f sets the hard limit for the number of files, -B sets the soft limit for block usage, and -b sets the hard limit for block usage.

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

    # showfsets dmn_2 set_1
    set_1
       Id           : 2feff762.00034e3f.1.8001
       Clone is     : set_1_clone
       Files        :      7,  SLim=  10000,  HLim=    20000
       Blocks (512) :    118,  SLim= 500000,  HLim=  1000000
       Quota Status : user=on  group=on
       Object Safety: off
       Fragging     : on
       DMAPI        : off
    

    Note that the soft limit for the number of blocks is 500000, twice the number 250000 that was input by using the chfsets command; similarly, the hard limit for the number of blocks appears to double from 500000 to 1000000. To avoid this confusion, enter the showfsets command with the -k option to display blocks in 1 KB units.

2.3.2.2    Setting the Grace Period

The fileset grace period is the same as the group grace period and cannot be modified independently (see Section 2.2.2). Therefore, if you use the edquota -gt command to change the grace period for which a fileset can exceed its soft limits, you also change the group grace period and vice versa. The default AdvFS grace period of 7 days remains in effect until you change it.

You can set only one grace period per fileset, but you can set different grace period values for block usage and number of files. The grace period applies to all users and all groups. If the grace period is reset, the new grace period for the fileset takes effect immediately unless the fileset has already exceeded its soft limits. In that case, the new grace period becomes effective once the fileset drops below the soft limit.

The following procedure sets the grace period for the filesets eb1, eb3, and eb4:

  1. Run the edquota command with the group grace period options. The command creates a temporary file with an ASCII representation of the current grace period and invokes an editor to allow you to modify the file:

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

  2. To change the fileset grace period for the number of blocks and for the number of files, edit the file to change the existing grace period:

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

  3. Exit the editor, saving the changes.

  4. Optionally, run the showfsets -q command to display the time (if exceeded) and fileset usage and limits:

    # showfsets -q eb_domain
                   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 means that the soft limit for block usage is exceeded. An asterisk (*) indicates that the hard limit has been reached.

2.3.3    Setting Quotas for Multiple Filesets

You can set quota limits for multiple filesets in a domain by listing more than one fileset name when you run the chfsets command (see Section 2.3.2).

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

# chfsets -b 1000 -f 200 eb1_domain data data2

Setting fileset quotas automatically activates the quotas.

2.3.4    Verifying File and Disk Space Usage

To examine how system resources are being used, look at fileset activity. The commands described in the following sections are useful for examining disk space and the file usage of filesets. The command reference pages contain additional information.

2.3.4.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:

The following example displays the amount of space available for fileset_1:

# df /fileset_1
Filesystem        512-blocks  Used Avail  Capacity  Mounted on
eb_domain#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).

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%. In the following example, the filesets domain_1#eb3 and domain_1#eb4 each can use all of the available disk space from the volumes in domain_1:

# df
  Filesystem   512-blocks    Used    Avail Capacity  Mounted on
domain_1#eb3    2000000  390820    98864    80%    /eb3
domain_1#eb4    2000000  271580    98864    73%    /eb4 
 

2.3.4.2    Displaying Fileset Limits

The showfsets -q command displays file usage, hard and soft limits, and grace period information for the filesets in the specified domain. It display s 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 eb_domain:

# showfsets -q eb_domain
  		     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 means that the soft limit for block usage is exceeded. An asterisk (*) would indicate that the hard limit has been reached.

2.3.4.3    Displaying Domain Space

The showfdmn command is useful for obtaining 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. For single-volume or multivolume domains, the command displays 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 Sat Jan 20 17:01 2000   512       4 usr_domain
 
 Vol  512-Blks    Free % Used Cmode Rblks Wblks Vol Name 
  1L  10605520 7757728    27%    on   256   256 /dev/disk/dsk8d

2.3.4.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:

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 eba that contains two filesets. Each has a quota limit of 60,000 blocks.

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

The following example displays the domain ebb 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 ebb
Domain     512-blocks   Metadata    Used   Available  Capacity
ebb           266240       5824   29128      231288       13% 
 
Fileset    QuotaLimit               Used   Available  Capacity
ebfsb              -              20800      231288       35%
ebfs2b             -               8328      231288       14% 

2.3.5    Activating Quotas

Running the command automatically activates fileset quotas immediately (see Section 2.3.3). No further steps are needed. Fileset quotas are in effect whenever you mount the fileset.

2.3.6    Deactivating Quotas

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