C H A P T E R  7

File System Quotas

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

Quotas help control the size of a file system by limiting the amount of space and the number of inodes 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.

This chapter describes the following topics:


Overview

You can set file system quotas on a user, group, or a site-defined admin set basis. You, the system administrator, can set limits on the number of files, the number of blocks online, and the total number of blocks.

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 sections provide background information about using quotas:

TABLE 7-1 shows the terms that are used extensively in this chapter's quota documentation.

TABLE 7-1 Quota Terminology

Term

Definition

grace period

The amount of time that can elapse during which a user is allowed to create files and/or allocate storage after users reach their soft limit.

soft limit

For disk quotas, a threshold limit on file system resources (blocks and inodes) that a user can temporarily exceed. Exceeding the soft limit starts a timer. When a user exceeds the soft limit for the specified time (the grace period), no further system resources can be allocated until the user reduces file system use below the soft limit.

hard limit

For disk quotas, a maximum limit on file system resources (blocks and inodes) that users cannot exceed.

quota

The amount of system resources that a user is allowed to consume.

timer

A facility for tracking the time elapsed after a user reaches a soft limit. When it reaches the grace period, a hard limit is imposed on the user.


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 system detects the presence of one or more quota files in the file system's root directory and the quota mount option is in effect. Note that the quota mount option is enabled by default, so you must not have disabled quotas by specifying the noquota mount option. 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. The system administrator's resource usage is accumulated in record zero. 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 7-2 shows the quota file names and the quotas they enable in /root.

TABLE 7-2 Quota File Names

Quota File Name in /root Directory

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.

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, and the system never allows a user to exceed this limit. A soft limit specifies a level of system resource use that can be exceeded temporarily. The soft limits are never larger than the hard limits. If a new user attempts to allocate resources beyond his or her hard limit, the operation is aborted. In this case, the operation (typically a write(2) or creat(2)) 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 but cannot exceed the hard 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 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 their 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 a user can specify to obtain information about quotas that pertain to them.

Quotas and Archive Media

You can use quotas to limit the amount of data that a user is allowed to have on archive media in Sun StorEdge QFS and Sun StorEdge SAM-FS file systems.

Example. The stage(1) command brings data online from archive media. It is possible for a user quota to be exceeded when the stage(1) command is invoked at the system level in the following way:

# stage -r *

A user quota is observed when a user issues the stage(1) -w command, as follows:

# stage -w *

The system stages files until the user's quota is met. After that time, no more files are staged.

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.


Enabling Quotas

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

TABLE 7-3 shows the commands used when manipulating quotas.

TABLE 7-3 Quota Commands

Command

Description

squota(1)

Displays quota statistics for a user. This is a subset of the samquota(1M) command.

samchaid(1M)

Changes file admin set ID attributes.

samquota(1M)

Displays quota statistics for a user, group, or admin set. This command also enables an administrator to edit quota records.

samquotastat(1M)

Reports which, if any, quotas are active on a file system.


When it is run, the samfsck(1M) command checks the file system to make sure that usage values recorded in the quota files match the actual file system usage totals. If they do not match, the samfsck(1M) command issues notices, and it updates all existing, incorrect quota records if a file system repair is performed.

The following sections 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 between 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 push 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 share 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:


procedure icon  To Configure a New File System to Use Quotas

The following procedure shows how to configure a new file system to use quotas. This procedure applies if you are creating a new file system at this time 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.

1. Become superuser.

2. Create the file system.

To create the file system, either follow the steps outlined in the Sun StorEdge QFS and Sun StorEdge SAM-FS Software Installation and Configuration Guide or use the examples in Configuration Examples to guide you through creating the mcf file, creating the mount point, initializing the file system, and so on.

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

Mount the file system using the mount(1M) command, as follows:

# mount /qfs1

4. Use the dd(1M) command to create the quota file(s).

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

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.

Unmount the file system in which the quota files have been created using the umount(1M) command. For example:

# umount /qfs1

The file system needs to 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.

Run the samfsck(1M) command on the file system. For example, the following command performs a file system check. 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.

Quotas are enabled when the system detects the presence of one or more quota files in the root directory of a file system.



caution icon

Caution - 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 on the mount(1M) command, and quotas are enabled automatically when the system detects the presence of quota files. Make sure that you do not have the noquota mount option specified in your samfs.cmd or /etc/vfstab files.

If quota files are present and if the file system is mounted without quotas enabled, when blocks or files are allocated or freed, the quota records become inconsistent with actual usages. If a file system with quotas is mounted and run without the quota mount option, run samfsck(1M) with its -F option 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.

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.


procedure icon  To Configure an Existing File System to Use Quotas

This procedure applies 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.

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

2. Use the mount(1M) command to ensure that the file system is mounted.

Examine the /etc/mnttab file using the mount(1M) command with no arguments, as follows:

# mount

3. Use the cd(1) command to change to the root directory.

Change to the root directory of the file system for which quotas are to be enabled. For example:

# cd /oldfs1

4. Verify that quotas do not already exist on the file system.

From the root directory, use the ls(1) -a command to retrieve the list of files in this directory. If at least one quota type (u, g, or a) 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 later.

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

5. Use the dd(1M) command to create the quota file(s).

Create the quota files for the type(s) of quota(s) you wish to enforce. 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 record for those IDs; each quota file record requires 128 bytes.

Example 1. 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:

Use the following command:

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

Example 2. If you want to enable group quotas, and group IDs up to 2000 are in use, the calculation is as follows:

Use the following command:

# dd if=/dev/zero of=/oldfs1/.quota_g bs=4096 count=63

Example 3. If you want to enable user ID quotas, and user IDs up to 4799 are in use, the calculation is as follows:

Use the following command:

# dd if=/dev/zero of=/oldfs1/.quota_u bs=4096 count=300

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 needs to 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) command to perform a file system check.

Use the samfsck(1M) -F command to perform a file system check. The samfsck(1M) command updates the quota files with correct, current usage information.

For example:

# samfsck -F /oldfs1



Note - The command in this step updates only the records already allocated in the quota files.



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.



caution icon

Caution - 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 on the mount(1M) command, and quotas are enabled automatically when the system detects the presence of quota files. Make sure that you do not have the noquota mount option specified in your samfs.cmd or /etc/vfstab files.

If quota files are present and if the file system is mounted without quotas enabled, when blocks or files are allocated or freed, the quota records become inconsistent with actual usages. If a file system with quotas is mounted and run without the quota mount option, 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.


procedure icon  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:

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 quotas on a user, group, or admin set basis by setting both the hard block and hard file limits to zero. The file system treats an infinite quota as a special quota. You can set infinite 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.


procedure icon  To Set an Infinite Quota

single-step bulletUse the samquota(1M) command to set an infinite quota.

For example, the following command sets an infinite quota:

# 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 7-2 shows how to set infinite quotas.

CODE EXAMPLE 7-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 by setting default limits into user, group, or admin set zero (0).


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

single-step bulletUse the samquota(1M) command to set an infinite quota.

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

On first reference, the preceding command sets any user's uninitialized admin set quota limits as follows:

Note that 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.


procedure icon  To Enable Limits for Users, Groups, or Admin Sets

single-step bulletUse the samquota(1M) command to set limits for users, groups, or admin sets.

CODE EXAMPLE 7-3 shows commands that enable various limits.

CODE EXAMPLE 7-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.


procedure icon  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.

Use the -e option with one or more of the following additional options: -U adminsetID, -G groupID, or -A adminsetID. Direct the output to a temporary file.

# samquota -G sam -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 40M:s:t -b 60M:h:t -t 0s:o -t 0s:t /sam6

You can use any temporary file. In Step 2, you use an editor to change one or more fields, so you can use a group quota entry as a template to create a user quota entry. CODE EXAMPLE 7-4 shows how to create and retrieve file quota.group to use as a template.

CODE EXAMPLE 7-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 file from Step 1.

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

CODE EXAMPLE 7-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. Execute the file using the shell.

This step applies the changes made in the editor. 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.

In similar fashion, you can use this procedure to generate quota commands that copy quota limits between users, groups, admin IDs, file systems, and other entities.


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. TABLE 7-4 shows commands you can use to check quotas.

TABLE 7-4 Commands for Checking Quotas

Command

Task

squota(1)

This is a user command. It displays user quotas and other information specific to a single user. For more information, see the squota(1) man page.

samquota(1M)

This is an administrator command. It displays user, group, and admin set quotas, and it displays current disk use. This command also displays information about users who are exceeding their quotas. For more information, see the samquota(1M) man page.



procedure icon  To Check for Exceeded Quotas

The following procedure shows how to check quotas for excess usage.

1. Become superuser.

2. Use the samquota(1M) command to display the quotas in effect.

Use the samquota(1M) command in one of the following ways to display quotas for mounted file systems in which quotas are enabled:

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 7-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 7-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 7-7 retrieves user memil's quota statistics in all mounted Sun StorEdge QFS and Sun StorEdge SAM-FS 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 7-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.

TABLE 7-5 shows the fields in the samquota(1M) output.

TABLE 7-5 samquota (1M) Output Fields

Field Name

Content

In Use

Current block usage.

Soft

Soft block limit

Hard

Hard block limit

Grace Period

Amount of time the user is allowed to exceed the soft limit


For groupID, specify the numeric group ID or the group name for the group of users whose quotas are being examined. For example, the following command retrieves user quota statistics for the group turtles in the qfs3 file system:

# samquota -G turtles /qfs3

For adminsetID, specify the numeric admin set ID of the site-specific administrator set whose quotas are being examined. For example, the following command retrieves user quota statistics for the admin set 457 in all mounted Sun StorEdge QFS and Sun StorEdge SAM-FS file systems:

# samquota -A 457 /qfs3


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 sections describe how to change and remove quotas. The topics are as follows:


procedure icon  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.

You can use the samquota(1M) command on a user, group, or admin set basis. CODE EXAMPLE 7-8 shows how to retrieve quota statistics.

CODE EXAMPLE 7-8 Using samquota (1M) to Retrieve Quota Statistics
# samquota -U userID [ file ]
# samquota -G groupID [ file ]
# samquota -A adminsetID [ file ]

TABLE 7-6 shows the arguments to these commands.

TABLE 7-6 samquota (1M) Command Arguments

Argument

Description

userID

Specify the numeric user ID or user name of the user whose quotas are being changed.

groupID

Specify the numeric group ID or the group name for the group of users whose quotas are being changed.

adminsetID

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

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.


2. Examine the output from the samquota(1M) command.

Examine the output and determine what the new limits should be.

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

CODE EXAMPLE 7-9 shows using the samquota(1M) command options to use to change the soft time limit grace period.

CODE EXAMPLE 7-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

TABLE 7-7 shows the arguments to these commands.

TABLE 7-7 samquota (1M) Command Arguments

Argument

Description

userID

Specify the numeric user ID or user name of the user whose quotas are being changed.

groupID

Specify the numeric group ID or the group name for the group of users whose quotas are being changed.

adminsetID

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

interval

Specifies the interval to use for the grace period. Specify an integer number for interval to indicate the quantity, and then specify a unit multiplier, if desired. By default, the unit multiplier is s to indicate that the interval is being specified in seconds. You can also specify w (for weeks), d (for days), h (for hours), or m (for minutes).

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. Assume that you want to change the grace period for user memil. CODE EXAMPLE 7-10 shows the samquota(1M) command used to verify the quotas and its output.

CODE EXAMPLE 7-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 enter the following command to lower the soft time limits:

# samquota -U memil -t 1d /sam6

CODE EXAMPLE 7-11 shows the samquota(1M) command to use to verify the new quotas.

CODE EXAMPLE 7-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 their 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:

Example. CODE EXAMPLE 7-12 retrieves information about group sam and shows that this group is over its soft limit.

CODE EXAMPLE 7-12 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)

CODE EXAMPLE 7-13 clears 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 7-13 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

CODE EXAMPLE 7-14 resets the grace period.

CODE EXAMPLE 7-14 Resetting the Grace Period
# 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

CODE EXAMPLE 7-15 expires the grace period.

CODE EXAMPLE 7-15 Expiring the Grace Period
# 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)

CODE EXAMPLE 7-16 sets a very long expiration period.

CODE EXAMPLE 7-16 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


procedure icon  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. The samquota(1M) command detects these inconsistent values, and reports them in its output. For example, the software inhibits 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 inconsisent 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 7-17 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 7-17 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 the -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.

Use the samquota(1M) command to reset the quotas to invalid values. 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 options in place of the -G option.

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

Use the samquota(1M) command to verify that the quota has been correctly changed. The following example obtains quota information for a group quota of the group sam:

# samquota -G sam /qfs1

Enter the samquota(1M) command again to verify the changed quotas. CODE EXAMPLE 7-18 shows this.

CODE EXAMPLE 7-18 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 (!) to indicate the over-quota condition in the output.

5. Use the sh(1) and samquota(1M) commands to restore the group's quota.

CODE EXAMPLE 7-19 shows the commands to restore and verify the changed quotas.

CODE EXAMPLE 7-19 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.


procedure icon  To Remove a File System's Quotas

To remove or disable quotas for a file system, you need to remove quota specifications from the mount process. The following procedure shows how to disable quotas for a file system.

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

2. Add the noquota mount option to the /etc/vfstab or samfs.cmd file. (Optional)

Perform this step only if you have the quota mount option in the /etc/vfstab or samfs.cmd file.

Use a viewer, such as vi(1) or cat(1) to examine the /etc/vfstab or samfs.cmd file for the presence of the quota mount option.

If this mount option is present, edit the file and remove the quota mount option.



Note - Beginning with the Sun StorEdge QFS and Sun StorEdge SAM-FS 4.1 releases, Sun Microsystems no longer recommends using the /etc/vfstab and samfs.cmd files for enabling or disabling quotas.



3. Use the umount(1M) command to unmount the file system.

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 on the mount(1M) command.

For example:

# mount -o noquota /myfs

5. Dispense with the quota files.

If you expect to reinstate the quota feature at a later date, do not destroy the quota files. To preserve the quota files and reinstate quotas at a later date, 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 quota mount option. The quota mount option can be specified in either the /etc/vfstab file or in the samfs.cmd file as a mount option, or it can be specified on the mount(1M) command with the -o quota option.

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]


procedure icon  To Correct Quotas

1. Become superuser.

2. Use the umount(1M) command to unmount the file system.

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 the quota files with correct, current usage information. Note, however, that it updates only records already allocated in the quota files. For example:

# samfsck -F myfs

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

For example:

# mount /myfs