Filer disk quotas restrict disk space and the number of files used by a user, a group, or a qtree. For information about how to create a qtree, refer to Chapter 12, "Qtree administration." This chapter discusses how to manage disk quotas by editing the /etc/quotas file.
To set up disk quotas, create a quotas file in the /etc directory.
Note: Keep a record of your quotas file in a safe place and update it as you change it, in case you must do a restore without having access to the root volume.
Following is a sample quotas file:
#Quota Target type disk files
/vol/home/user/joe user 500M 10K
21 group 750M 75K
/vol/eng/proj1 tree 750M 75K
writers group@/vol/eng/proj1 300M 50K
* user 50M 10K
Note: If the quota is a tree quota, the field in the type column of the quotas file displays tree, not qtree.
Keep a record of your quotas file in a safe place and update it as you change it, in case you must do a restore without having access to the root volume.
Specifies the user, group, or qtree on which you want to impose restrictions. You can assign more than one quota to a user or group, but only one quota to a qtree. The entries can be in any order.
You specify a user with one of the following targets:
The methods are equivalent, and inform the filer of the UID of the target. A file or directory is used only as the source of a UID; there are no quota implications for that file or directory. The UID of the user must not be 0.
Any file or subdirectory you use in the Quota Target field is referenced repeatedly throughout the life of the system, so if you use a path name, choose a path name that will last for as long as the user account remains on the system. For example, use a user's home directory for a user quota.
You specify a group with one of the following targets:
The methods are equivalent. A file or directory is used only as the source of a GID; there are no quota implications for that file or directory. The GID of the group must not be 0.
To create a tree quota, use the quota qtree command to create a directory in the root directory of a volume. The quota target in the quotas file for a tree quota is the complete path name of this directory.
Use an asterisk (*) in the Quota Target field to specify a default for the user or group quotas. Defaults do not apply to tree quotas. The default value applies to the following users or groups:
To override a default for a specific user or group, specify a quota for that user or group.
You can enter one of the following values in the Type field to define the quota type:
Specifies the maximum amount of disk space that the quota target can use. In this field, K is equivalent to 1,024 bytes, M means 2^20 bytes, and G means 2^30 bytes. If you omit the K, M, or G, the default is K.
If you want to track the disk usage but do not want to impose a disk usage limit on the quota target, enter a dash (-) in the disk field.
Note: Do not put a blank in the Disk field; it acts as white space. The filer regards the following entries as equivalent:
#Quota Target type disk files
/export tree 75K
/export tree 75K
Specifies the maximum number of files that the quota target can use. Use K to indicate 1,024 files. For example, 75K means 76,800 files. Use M to mean 2^20 and G to mean 2^30. You can omit the K, M, or G. For example, if you enter 100, it means the maximum number of files is 100. A blank in this field means there is no restriction on the number of files that the quota target can use.
If you want to track the number of files but do not want to impose a limit on the number of files that can be used by the quota target, enter a dash (-) in the files field.
Following is a sample quotas file that includes different kinds of quotas:
#Quota Target type disk files
/vol/home/user/jdoe user 500M 10K
108 user 500M 10K
jsmith user@/vol/rls 500M 10K
publications group 750M
/vol/home/eng group@/vol/cad 750M 75K
/vol/cad/proj1 tree 750M 75K
writers group@/vol/cad/proj1 150M
* user 50M 15K
* user@/vol/cad/proj1 50M 10K
* group 750M 85K
* group@/vol/cad/proj1 100M 75K
mhoward user 150M 100K
mhoward user@/vol/cad/proj1 75M 75K
mfisher user - -
Any operation that creates files or writes to them must satisfy all applicable quotas. The following list describes the effects of the sample quotas file:
Both user and group quotas apply to the entire specified volume (or the root volume if no volume name is specified). This is true even if the quota target in the quotas file is specified in the form of a path name. For example, if the quota target for the user named jdoe is /vol/home/user/jdoe, the filer imposes the quotas on all files written by jdoe, not just the ones written to /vol/home/user/jdoe.
The quotas file specifies what the restrictions are on users, groups, and trees. Whether these restrictions take effect depends on the quota command. The quota command enables you to do the following tasks:
Some of the information from quota commands is available through SNMP using the Network Appliance custom MIB. For more information about the MIB, refer to "About the Network Appliance custom MIB."
The quota on|off command enables or disables quotas for all volumes or a specific volume. Use the following syntax when using the command:
quotas [on|off] volume
Use the following command to enable quotas for a volume:
quota on volume
This command computes the disk usage of each quota target. The computation can take a few minutes to complete for a large number of quotas. To find out how much quota initialization the filer has completed, use the quota command without any arguments. For example:
quota
vol0: quotas are on.
vol1: quotas are initializing (24% done).
vol3: quotas are off.
Use the following command to disable quotas for a volume:
quota off volume
Because the filer remembers whether quotas are on or off even after it reboots, there is no need to add a quota command to /etc/rc.
The quota resize command updates active quotas without recalculating disk usage, and is faster than quota off followed by quota on. An active quota is one that appears in the output of the quota report command, discussed in "Displaying information about quotas."
You use the quota resize command after changing limits for a group or user. For example, jdoe has a disk quota of 500 MB, as shown in the following example.
#Quota Target type disk files
/vol/home/user/jdoe user 500M 10K
* user 10M 10K
Use the quota resize command to update the quota if jdoe's disk quota were increased, as shown in the following example:
#Quota Target type disk files
/vol/home/user/jdoe user 600M 10K
* user 10M 10K
The quota resize command usually ignores newly added quota targets. For each entry that it skips, the quota resize command prints the following message:
quota resize: new entry on line n in /etc/quotas
where n is a line number.
The quota resize command does not ignore newly added quota targets in the following situation:
If a default quota applies to the creator of a file, an active quota record is created for the owner of the file. If a newly added quota target is the user or group that has an active quota record, the quota resize command does not ignore the newly added quota target. That is, if a user or group has written to a file that is under the control of a default quota, a newly created entry in the quotas file for this user or group takes effect after a quota resize command.
After you edit the quotas file, if you want to make sure that all entries take effect, enter the quota off command followed by the quota on command. In this way, all quotas listed in the file become active.
You can use the quota resize command so that quotas can take effect on targets that have not created any files.
Because a quota becomes active when a quota target has written a file, you can make an entry in the quotas file an active quota by following these steps:
Because the quota target now has an active quota record, you can enter the quota resize command, including the volume name, to make the quota entry go into effect. This procedure takes less time than executing the quota off command followed by the quota on command because only the newly active quota is recalculated.
The quota report command displays the current consumption of files and space for each quota target and for each user and group that is under quota restrictions.
For example, if a user quota is specified in the quotas file for a user named jdoe, the quota report shows how many files and how much disk space have been used by jdoe. The Quota Specifier column in the quota report shows the same information as the Quota Target column in the quotas file, with the following exception:
If a user or group is under default quota restrictions, quota report displays information about the user or group as if the user or group had an entry in the quotas file. In this case, the Quota Specifier column in the quota report is blank.
With a path argument, quota report displays information about all quotas that apply to the specified file.
Follow these steps to limit disk space used by a user named jdoe.
Follow these steps to limit disk space used by a group named service.
To remove quota restrictions, follow these steps.
This section describes how the filer responds when quotas are exceeded and what users see on the client systems.
When it receives a write request, the filer first determines whether the file to be written is in a qtree. If the write would exceed the qtree quota, the filer logs the following error message:
tid tree_id: tree quota exceeded on volume_name
If the qtree is not full but the write would cause either the user or group quota to be exceeded, the filer logs one of the following errors:
uid user_id: disk quota exceeded
gid group_id: disk quota exceeded
where user_id is the user's UID and group_id is the group's GID.
To the client, the filer returns an "out of disk space" error to the NFS write request or a "disk full" error to the CIFS write request. The following sections describe how the clients notify the users about quotas being exceeded.
If a write from an NFS client to a filer causes a quota to be exceeded, the user experience depends on the operating system version and the application.
If a UNIX client mounts a filer without the noquota option, the login program on the client checks to see whether the user has reached the disk quota and file quota each time the user tries to log in to the client. The client displays a message to alert the user before displaying the system prompt if a quota was reached. In the following example, a user reached the disk quota on the filer mounted as /t/toaster on a client named client2:
rlogin client2
You have mail.
Block limit reached on /t/toaster
client2%
Not all versions of UNIX perform the quota check as described in this section. Also, the exact message printed varies from one version to another.
If a write causes a quota to be exceeded, the error message seen by the user depends on the application. For example, on a SunOS 4.x client, if a user tries to save a file using vi when his or her disk quota is reached, the error message is
Disc quota exceeded [Warning - /t/toaster/home/jdoe/file1 is incomplete]
If a write from a CIFS client to a filer causes a quota to be exceeded, the user experience depends on the operating system and the application. Following are two examples:
Cannot write file filename
Cannot create or replace filename: Cannot read from the source file or disk.
Copyright © 1999, Network Appliance, Inc. All rights reserved.
Part No. 210-02334
File: quota1.htm
Last updated: 02/24/99 12:16:58