C H A P T E R 5

Administering File System Quotas

This chapter describes how to enable and administer file system quotas. This chapter contains the following sections:

- Overview

- Enabling Quotas

- Checking Quotas

- Changing and Removing Quotas

##

Overview

File system quotas control the amounts of online and total disk space that can be consumed by a specific user, by a group of users, or by a site-determined group of users called an admin set.

Quotas help control the size of a file system by limiting the amount of space and the number of inodes that each user can consume. Quotas can be especially useful on file systems that contain user home directories. After quotas are enabled, you can monitor usage and adjust the quotas as needs change.

A file system provides a user with blocks for data and inodes for files. Each file uses one inode, and file data is stored in a disk allocation unit (DAU). DAU sizes are determined at the time the file system is created. Quotas account for disk usage in multiples of 512 bytes.

The following subsections provide background information about using quotas:

- Types of Quotas, Quota Files, and Quota Records

- Soft Limits and Hard Limits

- Disk Blocks and File Limits

### Types of Quotas, Quota Files, and Quota Records

You can set quotas according to user ID, group ID, or an administrator's site-specific grouping. This site-specific grouping is called an admin set ID. You can use an admin set ID, for example, to identify a collection of users working on a project for which file system quotas are imposed.

Quotas are enabled when the `quota` mount option is in effect and the system detects the presence of one or more quota files in the file system's root directory. The `quota` mount option is enabled by default. If you mount the file system with `noquota` in effect, quotas are disabled. For more information about mount options, see the `mount_samfs`(1M) man page.

Each quota file contains a sequence of records. Record zero is the record for the system administrator's quotas and resource usage. System administrator quotas are never enforced, but you can use any record, including the system administrator's record, as a template for subsequent records in the quota file. For more information about this practice, see To Enable or Change Limits for Users, Groups, or Admin Sets Using an Existing Quota File.

Record one is the record in the quota file for user one, group one, or admin set ID one, depending on the type of quota file. You can edit record one and all subsequent records in order to set different quotas for different users. TABLE 5-1 shows the quota file names and the quotas they enable in `/root`.

TABLE 5-1 Quota File Names
Quota File Name | Quota Type
--- | ---
`.quota_u` | UID (system user ID)
`.quota_g` | GID (system group ID)
`.quota_a` | AID (system admin set ID)

You can set default quota limits for users by editing record zero in the quota file and allowing the values in record zero to be used as the initial quota settings for all other users. By default, if user quota limits have not been set specifically, the system uses the values in record zero.

Each quota file requires 128 bytes of space. To calculate the necessary size for the initial zero quota file, use the following formula:

(highest-ID + 1) x 128 = x
x / 4096 = zero quota file size

### Soft Limits and Hard Limits

You can set both soft and hard limits. A hard limit specifies a fixed amount of system resources available for use, which the system never allows a user to exceed. A soft limit specifies a level of system resource use that can be exceeded temporarily, up to the hard limit. The soft limit is never larger than the hard limit.

If a user attempts to allocate resources beyond the hard limit, the operation is aborted. In this case, the operation fails and generates an `EDQUOT` error.

After a user exceeds a soft limit, a timer starts, and the user enters a grace period. While the timer is ticking, the user is allowed to operate above the soft limit. After the user goes below the soft limit, the timer is reset. If the grace period ends and the timer stops without the user's having gone below the soft limit, the soft limit is then enforced as a hard limit.

For example, assume that a user has a soft limit of 10,000 blocks and a hard limit of 12,000 blocks. If the user's block usage exceeds 10,000 blocks and the timer exceeds the grace period, this user is no longer able to allocate more disk blocks on that file system until usage drops below the 10,000-block soft limit.

You, the administrator, can use the `samquota`(1M) command to see the timer value. The `squota`(1) command is a user version of the `samquota`(1M) command. The `squota`(1) user command contains options that users can specify to obtain information about quotas that pertain to them.

### Disk Blocks and File Limits

It is possible for a user to exceed an inode quota, without using any blocks, by creating all empty files. It is also possible for a user to use only one inode and still exceed the block quota by creating a file that is large enough to consume all data blocks in the user's quota.

File system quotas are expressed in terms of the number of 512-byte blocks that a user can allocate. However, disk space is allocated to user files in terms of DAUs. The DAU setting is specified by the `-a` allocation-unit option to the `sammkfs`(1M) command. It is preferable to set a block quota to a multiple of the file system DAU. If this is not done, users can allocate only up to the block count, rounded down to the nearest DAU. See Enabling Default Quota Values for instructions on setting block quotas.

##

Enabling Quotas

You can enable quotas through a process that includes editing system files, creating quota files, and entering various quota commands.

The following subsections provide more details on how to configure a file system to use quotas and how to enable quotas.

### Guidelines for Setting Up Quotas

Before you enable quotas, you should determine how much disk space and how many inodes to allocate to each user. If you want to be sure that the total file system space is never exceeded, you can divide the total size of the file system by the number of users. For example, if three users share a 100-megabyte slice and have equal disk space needs, you could allocate 33 megabytes to each. In environments in which not all users are likely to reach their limits, you might want to set individual quotas so that they add up to more than the total size of the file system. For example, if three users shared a 100-megabyte slice, you could allocate 40 megabytes to each.

You can use the following quota commands, in the formats shown, for displaying quota information:

- The `squota`(1) command is for end users. It enables them to retrieve quota information for themselves on a user, group, or admin set basis.

- The `samquota`(1M) command is for system administrators. It enables you to retrieve quota information or to set quotas. Use the `-U`, `-G`, and `-A` options for a user, a group, or an admin set, respectively. CODE EXAMPLE 5-1 shows this.

CODE EXAMPLE 5-1 Using `samquota` (1M) to Retrieve Information
    # samquota -U janet /mount-point   #Prints a user quota
    # samquota -G pubs /mount-point    #Prints a group quota
    # samquota -A 99 /mount-point      #Prints an admin set quota

### To Configure a New File System to Use Quotas

Use this procedure if you are creating a new file system and no files currently reside in the file system. To configure an existing file system to use quotas, see To Configure an Existing File System to Use Quotas.

Before you start this procedure, make sure that you do not have the `noquota` mount option specified in your `samfs.cmd` or `/etc/vfstab` files.

1. Become superuser.

2. Create the file system.

Either follow the steps outlined in the Sun StorEdge QFS Installation and Upgrade Guide, or use the examples in Configuration Examples to create the `mcf`(4) file, create the mount point, initialize the file system, and so on.

3. Use the `mount`(1M) command to mount the file system.

For example:

    # mount /qfs1

4. Use the `dd`(1M) command to create the quota files.

The arguments to this command depend on the type of quota you are creating, as follows:

- To create admin set quotas, use the following command:

    # dd if=/dev/zero of=/qfs1/.quota_a bs=4096 count=1

- To create group quotas, use the following command:

    # dd if=/dev/zero of=/qfs1/.quota_g bs=4096 count=1

- To create user quotas, use the following command:

    # dd if=/dev/zero of=/qfs1/.quota_u bs=4096 count=1

For more information about the `dd`(1M) command, see the `dd`(1M) man page.

5. Use the `umount`(1M) command to unmount the file system in which the quota files have been created.

For example:

    # umount /qfs1

The file system must be unmounted so it can be remounted and have its quota files read at mount time. For more information about the `umount`(1M) command, see the `umount`(1M) man page.

6. Use the `samfsck`(1M) command to perform a file system check.

In the following example, the `-F` option resets the in-use values in the quota files:

    # samfsck -F qfs1

7. Use the `mount`(1M) command to remount the file system.

The system enables quotas when it detects the presence of one or more quota files in the `root` directory.

Note - You do not need to include the `quota` mount option in the `/etc/vfstab` or `samfs.cmd` file. The `quota` mount option is enabled by default with the `mount`(1M) command, and quotas are enabled automatically when the system detects the presence of quota files.

For more information about the `mount`(1M) command, see the `mount_samfs`(1M) man page.

8. Use the `samquota`(1M) command to set quotas for users, groups, or admin sets.

Subsequent sections in this chapter provide procedures and show examples of this process. For more information about the `samquota`(1M) command, see the`samquota`(1M) man page.

### To Configure an Existing File System to Use Quotas

Use this procedure if you are creating quotas for a file system that is already populated with files. If you are configuring a new file system to use quotas, see To Configure a New File System to Use Quotas.

Before you start this procedure, make sure that you do not have the `noquota` mount option specified in your `samfs.cmd` or `/etc/vfstab` files.

1. Use the `su`(1) command to become superuser.

2. Use the `mount`(1M) command to examine the `/etc/mnttab` file and ensure that the file system is mounted:

    # mount

Make sure that the file system is listed in the mount list that is displayed.

3. Use the `cd`(1) command to change to the root directory of the file system for which quotas are to be enabled.

For example:

    # cd /oldfs1

4. Use the `ls`(1) `-a` command to retrieve the list of files in this directory and verify that quotas do not already exist on the file system.

If any of the following files are present, quotas have been enabled for this file system:`.quota_u`,`.quota_g`,`.quota_a`.

If any quota type is established for a file system, you can establish any other quota type later. Be careful not to modify existing quota files when adding new ones.

5. If the quota files do not exist for the types of quotas you wish to enforce, use the `dd`(1M) command to create the quota files.

Determine the highest existing ID numbers of the types of quotas you wish to enforce. Make the initial, zero, quota files large enough to hold the records for those IDs; each quota file record requires 128 bytes.

For example, if you want to enable admin set quotas, and the highest admin set ID in use on the file system is 1024, the calculation is as follows:

(1024 + 1) x 128 = 131200

131200/4096 = 32.031...

Use the following command:

    # dd if=/dev/zero of=/oldfs1/.quota_a bs=4096 count=33

For more information about the `dd`(1M) command, see the `dd`(1M) man page.

6. Use the `umount`(1M) command to unmount the file system in which the quota files have been created.

For example:

    # umount /oldfs1

The file system must be unmounted so it can be remounted and have its quota files read at mount time. For more information about unmounting a file system, see Unmounting a File System.

7. Use the `samfsck`(1M) `-F` command to perform a file system check.

This command updates records allocated in the quota files with correct, current usage information.

For example:

    # samfsck -F /oldfs1

8. Use the `mount`(1M) command to remount the file system in which the quota files have been created.

The system enables quotas when it detects the presence of one or more quota files in the `/root` directory.

You do not need to include the `quota` mount option in the `/etc/vfstab` or `samfs.cmd` file. The `quota` mount option is enabled by default with the `mount`(1M) command, and quotas are enabled automatically when the system detects the presence of quota files.

Note - If quota files are present and if the file system is mounted with quotas disabled, the quota records become inconsistent with actual usages when blocks or files are allocated or freed. If a file system with quotas is mounted and run with quotas disabled, run the `samfsck`(1M) `-F` command to update the quota file usage counts before again remounting the file system with quotas enabled.

For more information about the `mount`(1M) command, see the `mount_samfs`(1M) man page.

9. Use the `samquota`(1M) command to set quotas for users, groups, or admin sets.

Subsequent sections in this chapter provide procedures and show examples of this process. For more information about the `samquota`(1M) command, see the `samquota`(1M) man page.

### To Assign Admin Set IDs to Directories and Files

1. Use the `su`(1) command to become superuser.

2. Set the admin IDs.

Use the `samchaid`(1M) command to change the admin set IDs for the directory or file, as follows:

- To set IDs for a file or directory, specify the directory name or path. For example:

    # samchaid 100 admin.dir

- To set IDs for a directory tree, use the `-R` and (if necessary) the `-h` options. The
  `-R` option specifies a recursive operation, and the `-h` option changes links, not targets. For example:

    # samchaid -R -h 22 /qfs1/joe /qfs1/nancee

For more information about the `samchaid`(1M) command, see the `samchaid`(1M) man page.

### Setting Infinite Quotas

An infinite quota is a kind of special quota. Users with infinite quotas are never denied access to any available file system resource. You can set infinite quota values into record zero of the user, group, or admin set ID quota files and then use this record as the default value for a new user, group, or admin set ID.

To Set an Infinite Quota

Use the `samquota`(1M) command to set the quota limit to zero.

For example:

    # samquota -U fred -b 0:h -f 0:h /qfs1

You can use the`samquota`(1M) command to set infinite quotas for particular users, groups, or admin set IDs by setting zero values for all hard and soft limits. CODE EXAMPLE 5-2 shows how to set infinite quotas.

CODE EXAMPLE 5-2 Setting Infinite Quotas
    # samquota -G sam -b 0:s,h -f 0:s,h /sam6
    # samquota -G sam /sam6
                                     Online Limits                Total Limits
            Type    ID    In Use     Soft     Hard    In Use     Soft     Hard
    /sam6
    Files  group   101       339        0        0       339        0        0
    Blocks group   101       248        0        0      2614        0        0
    Grace period                    0s                          0s
    ---> Infinite quotas in effect.

### Enabling Default Quota Values

You can use the `samquota`(1M) command to enable a default quota for a user, group, or admin set. This is accomplished through default limits in user, group, or admin set zero.

To Enable Default Quota Values for Users, Groups, or Admin Sets

Use the `samquota`(1M) command.

For example, the following `samquota`(1M) command sets default quotas for all admin set IDs:

    # samquota -A 0 -b 12000:s -b 15000:h -b 12G:s:t -b 15G:h:t \
    -f 1000:s -f 1200:h -t 1w /qfs1

The preceding command sets any user's uninitialized admin set quota limits as follows:

- The soft online block limit (`-b` limit`:s`) is set to 12,000 blocks.

- The hard online block limit (`-b` limit`:h`) is set to 15,000 blocks.

- The total soft block limit (`-b` limit`:s:t`) is set to 12 gigablocks.

- The total hard block limit (`-b` limit`:h:t`) is set to 15 gigablocks.

- The soft file limit (`-f` limit`:s`) is set to 1000 files.

- The hard file limit (`-f` limit`:h`) is set to 1200 files.

- The grace period (`-t` limit) is set to one week.

Note - If a quota record already exists, the existing values remain in effect. This occurs, for example, if the admin group already has blocks assigned to it.

You can set similar default quotas for users or groups by specifying`-U 0` or`-G 0`, respectively, in place of`-A 0`.

For more information about the `samquota`(1M) command, see the `samquota`(1M) man page.

### Enabling Limits

You can use the `samquota`(1M) command to enable a set of limits for a particular user, group, or admin set.

To Enable Limits for Users, Groups, or Admin Sets

Use the `samquota`(1M) command.

CODE EXAMPLE 5-3 shows commands that enable limits for users, groups, and admin sets, respectively.

CODE EXAMPLE 5-3 Quota Commands
    # samquota -U joe -b 15000:s -b 20000:h -b 12G:s:t -b 15G:h:t \
    -f 500:s -f 750:h -t 3d /qfs1
    # samquota -G proj -b 15000:s -b 20000:h -b 12G:s:t -b 15G:h:t \
    -f 500:s -f 750:h -t 3d /qfs1
    # samquota -A 7 -b 15000:s -b 20000:h -b 12G:s:t -b 15G:h:t \
    -f 500:s -f 750:h -t 3d /qfs1

For more information about the `samquota`(1M) command, see the `samquota`(1M) man page.

To Enable or Change Limits for Users, Groups, or Admin Sets Using an Existing Quota File

After quotas are established, you can use an existing quota file as a template when creating limits for another user, group, or admin set. The following procedure shows this. You can also use this procedure to change any of the quota settings.

1. Use the `samquota`(1M) command to retrieve a quota file, and direct the output to a temporary file.

Use the `-e` option with one or more of the following additional options: `-U` userID,
`-G` groupID, or `-A` adminsetID.

CODE EXAMPLE 5-4 shows how to create and retrieve file `quota.group` to use as a template.

Note - You can use a group quota entry as a template to create a user quota entry.

CODE EXAMPLE 5-4 File `quota.group`
    # samquota -G sam -e /sam6 > /tmp/quota.group
    # cat /tmp/quota.group
    # Type  ID
    #                Online Limits                          Total   Limits
    #            soft            hard                    soft            hard
    # Files
    # Blocks
    # Grace Periods
    #
    samquota -G 101 \
          -f      200:s:o -f      300:h:o         -f      200:s:t -f      300:h:t \
          -b    40000:s:o -b    60000:h:o         -b 40000000:s:t -b 60000000:h:t \
                     -t  0s:o                               -t 0s:t   /sam6

2. Use an editor to edit the temporary file you just created.

CODE EXAMPLE 5-5 shows the file that was generated in Step 1 opened in the `vi`(1) editor. Group ID `101` has been changed to `102`. This has the effect of generating a command to copy the quotas set for group `101` to group `102`.

CODE EXAMPLE 5-5 File `quota.group` After Editing
    # Type  ID
    #                Online Limits                          Total   Limits
    #            soft            hard                    soft            hard
    # Files
    # Blocks
    # Grace Periods
    #
    samquota -G 102 \
          -f      200:s:o -f      300:h:o         -f      200:s:t -f      300:h:t \
          -b    40000:s:o -b    60000:h:o         -b 40000000:s:t -b 60000000:h:t \
                     -t  1d:o                               -t 1d:t   /sam6

3. Save the file and exit the editor.

4. To apply the changes made in the editor, execute the file using the shell.

For example:

    # sh -x /tmp/quota.group

In this example, the `-x` option directs the shell to echo the commands it executes. You can omit the `-x` option if desired.

##

Checking Quotas

After you have enabled disk and inode quotas, you can check these quotas. The`samquota`(1M) command is an administrator command that generates a quota report on an individual user, group, or admin set. The `squota`(1) command is a user command that enables users to check their own individual quotas.

### To Check for Exceeded Quotas

1. Become superuser.

2. Use the `samquota`(1M) command to display the quotas in effect for mounted file systems.

- To display user quotas, specify the following command:

    # samquota -U userID [ file ]

For userID, specify the numeric user ID or user name of the user whose quotas are being examined.

For file, specify a specific file system for the selected user, group, or admin set. The file argument can also be the name of any file in the file system. Typically, file is the name of the root directory of the file system.

Example 1. CODE EXAMPLE 5-6 retrieves user `hm1259`'s quota statistics in the `sam6` file system on the server and displays output indicating that this user is not exceeding his quota.

CODE EXAMPLE 5-6 Checking for Exceeded Quotas for User `hm1259`
    # samquota -U hm1259  /sam6
                                     Online Limits                Total Limits
            Type    ID    In Use     Soft     Hard    In Use     Soft     Hard
    /sam6
    Files   user 130959        13      100      200        13      100      200
    Blocks  user 130959       152      200     3000       272     1000     3000
    Grace period                    0s                          0s

Example 2. CODE EXAMPLE 5-7 retrieves user `memil`'s quota statistics in all mounted Sun StorEdge QFS file systems and displays output indicating that this user is exceeding the quota. Note the plus sign (+) in the `Blocks` row of the output. The plus sign would appear in the `Files` row, too, if the soft quota limit were being exceeded for files.

CODE EXAMPLE 5-7 Checking for Exceeded Quotas for User `memil`
    # samquota -U memil
                                     Online Limits                Total Limits
            Type    ID    In Use     Soft     Hard    In Use     Soft     Hard
    /sam6
    Files   user 130967         4      500      750         4      500      750
    Blocks  user 130967     41016+   40000    50000     41016    50000    50000
    Grace period                    1w                          0s
    ---> Warning:  online soft limits to be enforced in 6d23h36m45s
    /sam7
    Files   user 130967         4      500      750         4      500      750
    Blocks  user 130967      4106    40000    50000      4106    50000    50000
    Grace period                    1w                          0s

If a hard limit has been exceeded, or if the soft limit has been exceeded and the grace period has expired, the offending `In Use` field is marked with an asterisk character (`*`). If a quota record's limits are determined to be inconsistent (for example, if a soft limit is larger than a hard limit), an exclamation point is used to mark the field, and all allocation operations are prevented.

- To display group quotas, specify the following command:

    # samquota -G groupID [ file ]

For groupID, specify the numeric group ID or the group name for the group of users whose quotas are being examined. For file, specify a specific file system for the selected group. The file argument can also be the name of any file in the file system. Typically, file is the name of the root directory of the file system.

For example, the following command retrieves user quota statistics for the group `turtles` in the `qfs3` file system:

    # samquota -G turtles /qfs3

- To display admin set quotas, specify the following command:

    # samquota -A adminsetID [ file ]

For adminsetID, specify the numeric admin set ID of the site-specific administrator set whose quotas are being examined. For file, specify a specific file system for the selected admin set. The file argument can also be the name of any file in the file system. Typically, file is the name of the root directory of the file system.

For example, the following command retrieves user quota statistics for the admin set 457 in all mounted Sun StorEdge QFS file systems:

    # samquota -A 457

##

Changing and Removing Quotas

You can change quotas to adjust the amount of disk space or number of inodes allocated to users. You can also remove quotas from users or from an entire file system. The following subsections describe how to change and remove quotas:

- To Change the Grace Period

- Changing the Grace Period Expiration

- To Inhibit Additional File System Resource Allocations

- To Remove a File System's Quotas

- To Correct Quotas

### To Change the Grace Period

You can use the `samquota`(1M) command to change the soft time limit grace period.

1. Use the `samquota`(1M) command to retrieve quota statistics for a user, group, or admin set.

See To Check for Exceeded Quotas for instructions.

Example. CODE EXAMPLE 5-8 retrieves information about group `sam` and shows that this group is over its soft limit.

CODE EXAMPLE 5-8 Exceeding a Soft Limit
    # samquota -G sam  /sam6
                                     Online Limits                Total Limits
            Type    ID    In Use     Soft     Hard    In Use     Soft     Hard
    /sam6
    Files  group   101        32     2000     2000        32     2000     2000
    Blocks group   101     41888*   40000 60000000     43208 60000000 60000000
    Grace period                    1w                          1w
    ---> Online soft limits under enforcement (since 30s ago)

2. Examine the output from the `samquota`(1M) command and determine what the new limits should be.

3. Use the `samquota`(1M) command to change the soft time limit grace period.

CODE EXAMPLE 5-9 shows using the `samquota`(1M) command options to use.

CODE EXAMPLE 5-9 Using `samquota` (1M) to Change Soft Time Limit Grace Periods
    # samquota -U userID -t interval file
    # samquota -G groupID -t interval file
    # samquota -A adminID -t interval file

The arguments for these commands are as follows:

- userID is the numeric user ID or user name of the user whose quotas are being changed.

- groupID is the numeric group ID or the group name for the group of users whose quotas are being changed.

- adminID is the numeric admin set ID of the site-specific administrator set whose quotas are being changed.

- interval is the interval to be used for the grace period. Specify an integer number for interval to indicate the quantity, and then specify a unit multiplier, if desired. The default unit multiplier is s, which indicates seconds. You can also specify w (for weeks), d (for days), h (for hours), or m (for minutes).

- file is the specific file system for the selected user, group, or admin set. The file argument can also be the name of any file in the file system. Typically, file is the name of the root directory of the file system

For example, suppose that you wanted to change the grace period for user `memil`. CODE EXAMPLE 5-10 shows the `samquota`(1M) command that you would use to verify the quotas and its output.

CODE EXAMPLE 5-10 Changing the Grace Period
    # samquota -U memil /sam6
                                     Online Limits                Total Limits
            Type    ID    In Use     Soft     Hard    In Use     Soft     Hard
    /sam6
    Files   user 130967         4      500      750         4      500      750
    Blocks  user 130967     41016+   40000    50000     41016    50000    50000
    Grace period                    3d                          0s
    ---> Warning:  online soft limits to be enforced in 2d23h59m7s

You would enter the following command to shorten the grace period.

    # samquota -U memil -t 1d /sam6

CODE EXAMPLE 5-11 shows the `samquota`(1M) command that you would then use to verify the new quotas.

CODE EXAMPLE 5-11 Verifying the New Quotas
    # samquota -U memil /sam6
                                     Online Limits                Total Limits
            Type    ID    In Use     Soft     Hard    In Use     Soft     Hard
    /sam6
    Files   user 130967         4      500      750         4      500      750
    Blocks  user 130967     41016+   40000    50000     41016    50000    50000
    Grace period                    1d                          0s
    ---> Warning:  online soft limits to be enforced in 23h58m31s

### Changing the Grace Period Expiration

If a user has exceeded the soft quota limit, changing the grace period itself does not modify the expiration timer of any grace periods that have already started. If the grace period is already in effect, you can use the `samquota`(1M) command to modify the grace period in one of the following ways:

- Clear the grace period timer - The next time the user allocates a file or block while still over a soft limit, the grace period timer is reset, and the grace period restarts.

CODE EXAMPLE 5-12 shows the command used to clear the timer so it starts counting the next time a user in group `sam` attempts to allocate a block or file in `/sam6.`

CODE EXAMPLE 5-12 Clearing the Timer
    # samquota -G sam -x clear /sam6
    Setting Grace Timer:  continue? y
    # samquota -G sam  /sam6
                                     Online Limits                Total Limits
            Type    ID    In Use     Soft     Hard    In Use     Soft     Hard
    /sam6
    Files  group   101        32     2000     2000        32     2000     2000
    Blocks group   101     41888+   40000 60000000     43208 60000000 60000000
    Grace period                    1w                          1w
    ---> Warning:  online soft limits to be enforced in 6d23h59m56s

- Reset the grace period timer - When an expiration period is reset, the timer is reset, and the grace period restarts.

CODE EXAMPLE 5-13 resets the grace period.

CODE EXAMPLE 5-13 Resetting the Grace Period Timer
    # samquota -G sam -x reset /sam6
    Setting Grace Timer:  continue? y
    # samquota -G sam  /sam6
                                     Online Limits                Total Limits
            Type    ID    In Use     Soft     Hard    In Use     Soft     Hard
    /sam6
    Files  group   101        32     2000     2000        32     2000     2000
    Blocks group   101     41888    40000 60000000     43208 60000000 60000000
    Grace period                    1w                          1w
    ---> Warning:  online soft limits to be enforced in 6d23h59m52s

- Set the grace period to a value - The timer is set to a value, and it starts counting down immediately from that value. There are no restrictions on this value. The value can be larger than the grace period.

CODE EXAMPLE 5-14 sets a very long expiration period.

CODE EXAMPLE 5-14 Setting a Very Long Grace Period
    # samquota -G sam -x 52w /sam6
    Setting Grace Timer:  continue? y
    # samquota -G sam  /sam6
                                     Online Limits                Total Limits
            Type    ID    In Use     Soft     Hard    In Use     Soft     Hard
    /sam6
    Files  group   101        32     2000     2000        32     2000     2000
    Blocks group   101     41888+   40000 60000000     43208 60000000 60000000
    Grace period                    1w                          1w
    ---> Warning:  online soft limits to be enforced in 51w6d23h59m54s

- Expire the grace period timer - The timer is set to expire immediately.

CODE EXAMPLE 5-15 expires the grace period.

CODE EXAMPLE 5-15 Expiring the Grace Period Timer
    # samquota -G sam -x expire /sam6
    Setting Grace Timer:  continue? y
    # samquota -G sam  /sam6
                                     Online Limits                Total Limits
            Type    ID    In Use     Soft     Hard    In Use     Soft     Hard
    /sam6
    Files  group   101        32     2000     2000        32     2000     2000
    Blocks group   101     41888    40000 60000000     43208 60000000 60000000
    Grace period                    1w                          1w
    ---> Online soft limits under enforcement (since 6s ago)

### To Inhibit Additional File System Resource Allocations

When the file system detects that quota values are not consistent for a user, group, or admin set, it prevents that user, group, or admin set from using any more system resources. You can inhibit file system resource allocations by creating inconsistent quota values. For example, you can inhibit further allocation if the hard block or file limits are lower than the soft block or file limits, or if a user's soft limit is larger than the user's hard limit.

The file system treats an inconsistent quota setting as a special quota. You can set inconsistent quota values into record zero of the user, group, or admin set ID quota files, and from there they can become the default values for new users, groups, or admin set IDs.

The following procedure shows how to inhibit further system resource allocations for a user, group, or admin set.

1. Become superuser.

2. Obtain, save, and examine current quota information.

CODE EXAMPLE 5-16 shows how to use the `samquota`(1M) command to retrieve current group quota information for group `sam` and write it to a backup file.

CODE EXAMPLE 5-16 Retrieving Group Quota Information
    # samquota -G sam -e /sam6 | & tee restore.quota.sam
    # Type  ID
    #                Online Limits                          Total   Limits
    #            soft            hard                    soft            hard
    # Files
    # Blocks
    # Grace Periods
    #
    samquota -G 101 \
          -f     2000:s:o -f     2000:h:o         -f     2000:s:t -f     2000:h:t \
          -b    40000:s:o -b 60000000:h:o         -b 60000000:s:t -b 60000000:h:t \
                     -t  1w:o                               -t 1w:t \
          -x 51w6d23h59m:o                       -x clear     /sam6

To obtain quota information about a user quota, specify th`e` `-U` userID option in place of the `-G` option. To obtain quota information about an admin set quota, specify the `-A` adminID option in place of the `-G` option.

3. Use the `samquota`(1M) command to set soft quotas to nonzero quotas and hard quotas to zero quotas.

The following command sets the quotas for group `sam` to be inconsistent:

    # samquota -G sam -f 1:s -f 0:h -b 1:s -b 0:h /sam6

To make the quotas for users or admin sets inconsistent, specify the `-U` userID or
`-A` adminID option in place of the `-G` option.

4. Use the `samquota`(1M) command to verify your changes.

CODE EXAMPLE 5-17 shows this.

CODE EXAMPLE 5-17 Verifying Changed Quotas
    # samquota -G sam  /sam6
                                     Online Limits                Total Limits
            Type    ID    In Use     Soft     Hard    In Use     Soft     Hard
    /sam6
    Files  group   101        32!       1        0        32!       1        0
    Blocks group   101     41888!       1        0     43208!       1        0
    Grace period                    1w                          1w
    ---> Quota values inconsistent; zero quotas in effect.

In the preceding output, a zero quota is in effect. Note the exclamation point characters (`!`), which indicate the over-quota condition in the output.

5. Use the `sh`(1) and `samquota`(1M) commands to restore the group's quota to what it was before the file/block allocation was inhibited and then to verify the changed quotas.

CODE EXAMPLE 5-18 shows these commands.

CODE EXAMPLE 5-18 Restoring the Group Quota
    # sh restore.quota.sam
    Setting Grace Timer:  continue? y
    Setting Grace Timer:  continue? y
    # samquota -G sam  /sam6
                                     Online Limits                Total Limits
            Type    ID    In Use     Soft     Hard    In Use     Soft     Hard
    /sam6
    Files  group   101        32     2000     2000        32     2000     2000
    Blocks group   101     41888+   40000 60000000     43208 60000000 60000000
    Grace period                    1w                          1w
    ---> Warning:  online soft limits to be enforced in 6d23h59m54s

To perform this operation on a user quota, specify the `-U` userID option in place of the `-G` option. To perform this operation on an admin set quota, specify the`
-A` adminID option in place of the `-G` option.

### To Remove a File System's Quotas

To remove or disable quotas for a file system, you need to disable quotas in the mount process.

1. Use the `su`(1) command to become superuser.

2. (Optional) Use a text editor to add the `noquota` mount option to the `/etc/vfstab` or `samfs.cmd` file.

Alternatively, you can specify `noquota` as an option later, when you issue the mount command. See Step 4.

3. If the file system is mounted, use the `umount`(1M) command to unmount the file system.

For example:

    # umount /myfs

If you have difficulty unmounting the file system, see Unmounting a File System.

4. Remount the file system using the `mount`(1M) command.

If you did not perform Step 2, include the `noquota` option with the `mount`(1M) command.

For example:

    # mount -o noquota /myfs

5. Dispense with the quota files by doing one of the following:

- If you expect to reinstate the quota feature later and therefore do not want to destroy the quota files, unmount the file system, run the `samfsck`(1M) command with its `-F` option on the file system, and remount the file system again with the `noquota` mount option removed.

- If you do not expect to reinstate the quota feature at a later date, or if you want to reclaim the space consumed by the quota files, use the `rm`(1) command to remove the `.quota_u`, `.quota_g`, and `.quota_a` files. For example:

    # rm /myfs/.quota_[agu]

### To Correct Quotas

1. Become superuser.

2. If the file system is mounted, use the `umount`(1M) command to unmount the file system.

For example:

    # umount /myfs

If you have difficulty unmounting the file system, see Unmounting a File System.

3. Use the `samfsck`(1M) `-F` command to perform a file system check.

The `samfsck`(1M) command updates records allocated in the quota files with correct, current usage information.

For example:

    # samfsck -F myfs

4. Use the `mount`(1M) command to remount the file system.

For example:

    # mount /myfs

Copyright © 2006, Sun Microsystems, Inc. All Rights Reserved.