AdvFS allows you to activate quotas to track and control the amount of physical storage that each user, group, or fileset consumes. You must have root user privilege to set and edit quotas. The root user is never restricted by quota limits; quota limits only apply to nonroot users.
The AdvFS quota system is compatible with the Berkeley-style quotas of UFS. However, the AdvFS quota system differs in two ways:
AdvFS differentiates between quota maintenance and quota enforcement. Quota information is always maintained, but enforcement can be activated and deactivated.
AdvFS supports fileset quotas; that is, you can set quota limits for the filesets in a file domain.
You can set two quota values: on the amount of disk storage and on the number of files. In addition there are two types of quotas you can set:
User and group quotas
AdvFS user and group quotas are similar to UFS quotas. You can set a separate quota for each user or each group of users for each fileset.
Fileset quotas
You can restrict the space that a fileset itself can use. Fileset quotas are useful when a file domain contains multiple filesets. Without fileset quotas, any fileset can grab all of the disk space in the file domain.
For example, it is useful to set quotas on filesets that contain home directories
such as
/usr/users
because these filesets can grow rapidly.
Conversely,
setting quota limits on the
/tmp
fileset is not recommended because
this fileset is likely to fluctuate in size.
Limits are set on disk usage (number of blocks) or on number of files (inodes)
or both.
Table 3-1
shows the size limits for both types
of quota values.
Table 3-1: Quota Size Limits
User and Group Quotas | Fileset Quotas | |
Disk Usage | 8 billion terabytes* | 4 billion terabytes |
Number of Files | 4 billion | 4 billion |
* Prior to Version 5.0, the disk usage limit for user and group quotas was 2 terabytes. If your file domain was created prior to Version 5.0, and if you are now running Version 5.0 or later, you must upgrade your file domain if you wish to take advantage of the new limits (see Section 2.3.3).
All quotas can have two types of limits: hard and soft. A hard limit cannot be exceeded. No more space can be allocated or files created. A soft limit permits a period of time during which the limit can be exceeded as long as the hard limit has not been exceeded.
Hard and soft limits can be set or changed by the root user at any time and take effect the next time quotas are activated. Hard and soft limits can be set for users, for groups, and for filesets.
The default is no quota limit. You can also:
Set the hard limit to 0 blocks or files to impose no quota limits.
Set the hard limit to 1 block or file to permit no disk space allocations.
Set the soft limit to 1 block or file and the hard limit to 0 blocks or files to permit disk-space allocations on a temporary basis. These limits remain in effect until you unmount the fileset.
See
Section 7.1.2.3
for directions if your activities cause
you to run into limits.
3.1.2 Grace Period
Associated with each soft limit is a grace period. The grace period is the amount of time during which the soft limit can be exceeded. When the grace period expires, no one can create new files or allocate any more disk space until enough files are deleted to fall below the soft limit. Updating existing files may cause loss of data.
The timer for the grace period starts when the user exceeds the soft limit. If you allow no grace period, the user can exceed the soft limit only once. The grace period is turned off and reset each time usage drops below the soft limit. If you change the grace period after the user has exceeded the soft limit, the old grace period stays in effect until usage drops below the limit.
You can set grace periods for:
Users
For each fileset you can set only one grace period for all users (see Section 3.2.2). If the user grace period expires, the user cannot allocate storage in the fileset until enough files are deleted to fall below the soft limit. The grace periods for the number of blocks and for the number of files do not need to be the same.
Groups
For each fileset you can only set one grace period for all groups (see Section 3.2.2). If the group grace period expires, no one in the group can allocate storage in the fileset until enough files are deleted to fall below the soft limit. All users are limited by the group grace period, even if the fileset grace period is larger.
Filesets
The fileset grace period is the same as the group grace period (see Section 3.3.2.2). Any user or group can cause the fileset to exceed its soft limit and thereby evoke the fileset grace period. Any user or group (not necessarily the one that exceeded the limit) can delete files to bring the fileset below the soft limit.
AdvFS sets a default grace period of 7 days. This period can be changed (see Section 3.2.2 and Section 3.3.2). You can specify the grace period in days, hours, minutes, or seconds. You can also:
Set the grace period to 0 days to impose the default grace period of 7 days.
Set the grace period to 1 second to allow no grace period.
The following sections describe quota files and how quotas and grace periods
are set for users and groups.
3.2.1 Quota Files
AdvFS creates quota files to track quotas, grace periods, and fileset usage. Quota files are maintained within the fileset but, unlike UFS, the user cannot delete or create them. Quota files are present in the fileset even if quota limits have not been established.
AdvFS keeps user and group quota information in the root directory of the fileset
in the
quota.user
and
quota.group
files.
These
files are created when the fileset is created.
They are indexed by user ID and group
ID.
Each quota file entry contains the following information: hard block limit, soft
block limit, block usage, hard file limit, soft file limit, file usage, block grace
period, and file grace period.
Quota files are sparse files (see
Section 1.3.3); that is,
there are holes in the file where no user IDs or group IDs fall.
Use the
ls
command with the
-l
option to see the space spanned
by the
quota.user
or the
quota.group
file.
This
does not show the actual disk usage.
For example:
#
ls -l quota.user
-rw-r----- 1 root operator 294912 Jul 20 08:50 quota.user
Use the
ls
command with the
-s
option
to display how many blocks the file actually uses:
#
ls -s quota.user
16 quota.user
To enforce user and group quotas for a fileset, the
/etc/fstab
file must have the following quota mount point options for the fileset:
advfs rw,userquota,groupquota 0 2
You can relocate the
quota.user
and
quota.group
files to subdirectories of the fileset.
However, you cannot relocate them
to other filesets nor delete them.
If you relocate your files, you must update the
/etc/fstab
file entry to include the path and name of the relocated file(s)
in the userquota and groupquota parameters.
For example, to relocate the
quota.user
file to the subdirectory
d4
and rename itnquot
,
change the
/etc/fstab
entry to:
dom_1#fset /mnt advfs rw,userquota=/mnt/d4/nquot,groupquota 0 2
In this example, the group quota file is not moved.
Whether or not you relocate your quota files, you do not need to enforce quotas.
See
Section 3.2.7
for instruction on deactivating user and
group quotas.
3.2.2 Setting Quotas and Grace Periods
You are not required to set both user and group quotas. If you specify a group quota, it will apply to all users belonging to that group. If you specify a user quota that is larger than the group quota, it will have no effect because the group quota will take effect before the user quota is reached.
Use the
edquota
command to set the quotas for users and groups
and again to change the grace period.
The fileset must be mounted before you can set
quotas and grace periods.
Note that for each fileset, only one grace period can be
set for all users and one grace period can be set for all groups.
However, you do
not have to set the same grace period for the number of blocks and for the number
of files.
The group grace period you set is also entered as the fileset grace period
(see
Section 3.3.2.2).
Follow these general steps to set user and group quotas and grace periods:
Add quota file mount point options to the
/etc/fstab
file.
Enter the
edquota
command with the
-u
option to set user quotas or the
-g
option to set group
quotas.
An ASCII representation of the quota file is displayed through the editor
specified by the EDITOR environmental variable.
If EDITOR is not set, the
vi
editor is used.
When the user or group quota information is displayed, modify the values in the limits fields as needed. Then, exit the editor, saving the changes.
To set user or group grace periods, enter the
edquota
command with the
-ut
option for user or
-gt
option for group.
Note that the fileset grace period is the same as the group grace
period.
When the grace period information is displayed, modify the grace period as desired. Then, exit the editor, saving the changes.
To change the default editor and for more information, see
edquota
(8).
The quota limits you set for a fileset do not take effect until you activate
them.
Use the
quotaon
command to activate quotas (see
Section 3.2.5
and
Section 3.2.6).
If you are changing quota limits and quotas
have already been activated for a fileset, the new limits become effective immediately.
If you have set quotas for a single user, you can use the
edquota
command with the
-p
option to create prototype quota
files.
Then you can apply the prototype quota to other users that you specify (see
Section 3.2.3).
3.2.2.1 User Quotas Example
The following example sets quotas for the user
user5
:
If they do not already exist, add quota mount-point options to the
/etc/fstab
file.
Note that there can be no spaces in the list of options
delimited by commas; that is, from
rw
through
groupquota
:
domain_1#test1 /test1 advfs rw,userquota,groupquota 0 2
domain_2#test3 /test3 advfs rw,userquota,groupquota 0 2
domain_4#test4 /test4 advfs rw,userquota,groupquota 0 2
Enter the
edquota
command with the
-u
option followed by the user name.
If you specify more than one user name,
the edits will affect all users named.
The command creates a temporary file with an
ASCII representation of the current quotas assigned to the named users and invokes
an editor to allow you to modify the file:
#
edquota -u user5
Quotas for user user5: /test1: blocks in use: 0, limits (soft = 0, hard = 0) inodes in use: 0, limits (soft = 0, hard = 0) /test3: blocks in use: 0, limits (soft = 0, hard = 0) inodes in use: 0, limits (soft = 0, hard = 0) /test4: blocks in use: 0, limits (soft = 0, hard = 0) inodes in use: 0, limits (soft = 0, hard = 0)
The
values for
blocks in use
and
inodes in use
are
the current block usage and the number of files for each fileset.
You cannot change
them.
Soft and hard limits of 0 (zero) indicate that no limits have been set.
To change user quotas for
user5
for fileset
test3
, edit the file.
Enter the new limits for disk usage on the
blocks
line and enter the new limits for the number of files on the
inodes
line:
/test3:blocks in use: 0, limits(soft=5000
, hard=10000
)
inodes in use: 0, limits(soft= 100
, hard= 200
)
Exit the editor, saving the changes.
If quotas have already been activated for fileset
test3
,
the new limits become effective immediately.
If quotas are not yet activated for the
fileset, the limits become effective as soon as quotas are activated (see
Section 3.2.6).
Quotas set for the group to which the user belongs take precedence over quotas
set for the user of the fileset.
3.2.2.2 User Grace Period Example
When you impose soft limits for a fileset, you can set a grace period for that fileset. If you do not specify a grace period, the grace period remains at the AdvFS default of 7 days. You can set different grace periods for the number of blocks and for the number of files. If the group grace period is less than a user grace period, the user is limited by the group grace period.
The following example sets the grace period for all users of fileset
test3
:
Run the
edquota
command with the user grace period
options.
The command creates a temporary file with an ASCII representation of the
current grace period and invokes an editor to allow you to modify the file:
#
edquota -ut
Time units may be: days, hours, minutes, or seconds Grace period before enforcing soft limits for users: /test1: block grace period: 7 days,file grace period: 7 days /test3: block grace period: 7 days,file grace period: 7 days /test4: block grace period: 7 days,file grace period: 7 days
To set the user grace period for the number of blocks and for the
number of files for
test3
, edit the file to change the existing
grace period:
Time units may be: days, hours, minutes, or seconds
Grace period before enforcing soft limits for users:
/test1: block grace period: 7 days,file grace period:7 days
/test3: block grace period: 2 days,file grace period:3
days
/test4: block grace period: 7 days,file grace period:7 days
Exit the editor, saving the changes.
If quotas have already been activated for the fileset
test3
,
the new grace period becomes effective immediately.
If a user has already exceeded
the soft limit, the grace period becomes effective once the usage drops below the
soft limit.
If quotas are not yet activated for the fileset, the grace period becomes
effective as soon as quotas are activated (see
Section 3.2.6).
3.2.2.3 Group Quotas Example
The following example sets quotas on
test3
for the group
rsgusers
:
If they do not already exist, add quota mount-point options to the
/etc/fstab
file.
Note that there can be no spaces in the list of options
delimited by commas; that is, from
rw
through
groupquota
:
domain_1#test1 /test1 advfs rw,userquota,groupquota 0 2
domain_2#test3 /test3 advfs rw,userquota,groupquota 0 2
domain_4#test4 /test4 advfs rw,userquota,groupquota 0 2
Enter the
edquota
command with the
-g
option.
If you specify more than one group name, the edits will affect
all groups named.
The command creates a temporary file with an ASCII representation
of the current quotas assigned to the named groups and invokes an editor to allow
you to modify the file:
#
edquota -g rsgusers
Quotas for group rsgusers: /test1: blocks in use: 0, limits (soft=0, hard=0) inodes in use: 0, limits (soft=0, hard=0) /test3: blocks in use: 0, limits (soft=0, hard=0) inodes in use: 0, limits (soft=0, hard=0) /test4: blocks in use: 0, limits (soft=0, hard=0) inodes in use: 0, limits (soft=0, hard=0)
The values for
blocks in use
and
inodes in use
are the current block usage and the number of files for each fileset.
You
cannot change them.
Soft and hard limits of 0 (zero) indicate that no limits have
been set.
To change the group quotas for
test3
, edit the
file.
Enter the new limits for disk usage on the
blocks
line and
enter the new limits for the number of files on the
inodes
line:
/test3: blocks in use:0,limits(soft=60000
, hard=80000
)
inodes in use:0,limits(soft= 6000
, hard= 8000
)
Exit the editor, saving the changes.
If quotas have already been activated for fileset
test3
,
these limits become effective immediately.
If quotas are not yet activated for
test3
, these limits become effective as soon as quotas are activated (see
Section 3.2.6).
Quotas set for the group take precedence over quotas set
for the individual.
3.2.2.4 Group Grace Period Example
When you impose soft limits, you can set one grace period per fileset for all groups. If you do not specify a grace period, the grace period remains the AdvFS default of 7 days. You can set different grace periods for the number of blocks and for the number of files. The group grace period takes precedence over all user grace periods.
The following example sets the grace period for all groups for fileset
test3
:
Run the
edquota
command with the group grace period
options.
The command creates a temporary file with an ASCII representation of the
current grace period and invokes an editor to allow you to modify the file:
#
edquota -gt
Time units may be: days, hours, minutes, or seconds Grace period before enforcing soft limits for groups: /test1: block grace period: 7 days,file grace period:7 days /test3: block grace period: 7 days,file grace period:7 days /test4: block grace period: 7 days,file grace period:7 days
To set the group grace period for the number of blocks and for the
number of files for
test3
, edit the file to change the existing
grace period:
Time units may be: days, hours, minutes, or seconds
Grace period before enforcing soft limits for groups:
/test1: block grace period: 7 days,file grace period:7 days
/test3: block grace period:12
hours,file grace period:5
days
/test4: block grace period: 7 days,file grace period:7 days
Exit the editor, saving the changes.
If quotas have already been activated, this grace period becomes effective
immediately unless a group has already exceeded the soft limit for
test3
.
In that case, the new grace period becomes effective for that group once
the group usage drops below the soft limit.
If quotas are not yet activated, the group
grace period becomes effective as soon as they are activated (see
Section 3.2.6).
3.2.3 Setting Quotas for Multiple Users and Groups
AdvFS allows you to use a single command to modify quotas for a list of users or groups so you do not need to access and enter values for each one individually. Note that you do not have to set multiple grace periods because, for each user or group quota, one grace period applies to all users or to all groups.
Use the
edquota
command with the
-p
option
to take existing quota information and establish it as a prototype user or group quota.
Then apply the prototype to one or more users or groups.
For example, to set up all student accounts to have the same disk usage quota:
Establish a set of quotas for a single student.
Use the
edquota
command with the desired limits.
Use the
edquota
command with the
-p
option to apply the quotas set up for the first user to other student accounts.
3.2.3.1 Prototype User Example
The following example sets up prototype-user quotas that are then used to modify the quotas for other users:
Set quotas for one user,
user5
(see
Section 3.2.2.1):
#
edquota -u user5
Quotas for user user5: /test1:blocks in use:0,limits(soft=
20000
,hard=30000
) inodes in use:0,limits(soft=350
,hard=500
) /test3:blocks in use:1,limits(soft=30000
,hard=40000
) inodes in use:4,limits(soft=400
,hard=550
) /test4:blocks in use:2,limits(soft=10000
,hard=20000
) inodes in use:1,limits(soft=150
,hard=200
) /test5:blocks in use:2,limits(soft=100000
,hard=150000
) inodes in use:1,limits(soft=5000
,hard=7000
)
To create quotas for new users
user7
,
user8
, and
user9
, use the quotas from user
user5
as a prototype:
#
edquota -p user5 -u user7 user8 user9
To verify that the quotas were set, run the
edquota
command for
user7
:
#
edquota -u user7
Quotas for user user7: /test1:blocks in use:0,limits(soft= 20000,hard= 30000) inodes in use:0,limits(soft= 350,hard= 500) /test3:blocks in use:0,limits(soft= 30000,hard= 40000) inodes in use:0,limits(soft= 400,hard= 550) /test4:blocks in use:0,limits(soft= 10000,hard= 20000) inodes in use:0,limits(soft= 150,hard= 200) /test5:blocks in use:0,limits(soft=100000,hard=150000) inodes in use:0,limits(soft= 5000,hard= 7000)
3.2.3.2 Prototype Group Example
The following example sets up prototype group quotas that are then used to modify the quotas for another group:
Set quotas for the group
rsgusers
(see
Section 3.2.2.3):
#
edquota -g rsgusers
Quotas for group rsgusers: /test1:blocks in use:0,limits(soft=
100000
,hard=200000
) inodes in use:0,limits(soft=10000
,hard=20000
) /test3:blocks in use:0,limits(soft=300000
,hard=400000
) inodes in use:0,limits(soft=30000
,hard=40000
) /test4:blocks in use:0,limits(soft=500000
,hard=600000
) inodes in use:0,limits(soft=50000
,hard=60000
) /test5:blocks in use:0,limits(soft=350000
,hard=450000
) inodes in use:0,limits(soft=35000
,hard=45000
)
To create quotas for a new group,
rsgstudents
,
use the quotas from group
rsgusers
as a prototype:
#
edquota -p rsgusers -g rsgstudents
To verify that the quotas were set, run the
edquota
command for
rsgstudents
:
#
edquota -g rsgstudents
Quotas for group rsgstudents: /test1:blocks in use:0,limits(soft=100000,hard=200000) inodes in use:0,limits(soft= 10000,hard= 20000) /test3:blocks in use:0,limits(soft=300000,hard=400000) inodes in use:0,limits(soft= 30000,hard= 40000) /test4:blocks in use:0,limits(soft=500000,hard=600000) inodes in use:0,limits(soft= 50000,hard= 60000) /test5:blocks in use:0,limits(soft=350000,hard=450000) inodes in use:0,limits(soft= 35000,hard= 45000)
3.2.4 Verifying File and Disk Space Usage
Even if you are not enforcing quotas, you can monitor file and disk space usage
with the
df
,
showfdmn
,
showfsets
,
and
vdf
commands.
See the appropriate reference pages.
If you are enforcing quotas, you can periodically verify your quota setup. You can display user and group quota information in a number of ways. If you are not the root user, you can display information only for your own files. The root user can display all user and all group quota information for all filesets.
The commands shown in
Table 3-2
are useful for examining
disk space and file usage for filesets for which user and group quotas are enforced.
Table 3-2: User and Group Usage Commands
Command | Description |
ncheck
|
Prints the tag and full path name for each file in the fileset |
quot |
Summarizes fileset ownership |
quota |
Displays disk usage and limits by user or group |
quotacheck |
Checks fileset quota consistency |
repquota |
Summarizes quotas for a fileset |
See the command reference pages for more information.
If your disk usage information appears to be corrupt, see
Section 7.1.1
for instructions on how to correct this.
3.2.4.1 Printing the Tag and Full Path Name for Each File
The
ncheck
command lists files by tag (inode) number.
By
piping the output to the
sort
command, you can use the sorted output
as input for the
quot
command to list all files and their owners.
Use the following format to generate the listing:
ncheck
domain#fileset
|sort +0n| quot -n
domain#fileset
3.2.4.2 Summarizing Fileset Ownership
The
quot
command displays block usage and the number of
files in the fileset that each user owns.
If you do not specify a fileset, the command
processes all filesets in the
/etc/fstab
file that include the
ro
,
rw
, and
rq
mount options.
The
quot
command entered with no options displays only blocks:
#
quot domain_1#set_1
domain_1#set_1: 34128 root 816 user5
The
quot
command entered with the
-f
option
displays both blocks and files:
#
quot -f domain_1#set_1
domain_1#set_1: 34128 125 root 816 9 user5
3.2.4.3 Displaying Disk Usage and Limits
The
quota
command displays the block usage, number of files,
and quotas for a user or group.
Users can run this command to look at their own disk
space usage.
The root user can look at usage for the whole system.
You can choose to display quota information for users or groups, for all filesets with usage over quota, or for all mounted filesets regardless of whether quotas are activated.
The quota command displays the block usage of the fileset, soft limit (quota
), hard limit (limit
), grace period, and number
of files used for each user.
An asterisk (*) in a column means that a soft quota limit
has been exceeded.
Note that the grace period is not displayed unless the soft limit
has been exceeded.
Use the
edquota
command to view complete quota
specifications.
The following example shows quota information for the user
user5
:
#
quota -u user5
Disk quotas for user user5 (uid 446): Filesystem blocks quota limit grace files quota limit grace / 60 100 150 3 10 20 /usr 5071* 5000 10000 24:40 2 20 40 /test1 816 20000 30000 9 350 500 /test2 22032 50000 200000 2 2000 4000 /test3 2344 10000 15000 370 1000 2000 /test4 18023* 10000 20000 7days 3 100 150 /test5 32012* 20000 50000 7days 0 2000 3000
The following example shows quota information for the group
rsgusers
:
#
quota -g rsgusers
Disk quotas for group rsgusers (gid 15): Filesystem blocks quota limit grace files quota limit grace / 118 200 300 2 20 40 /usr 13184* 10000 20000 7days 2 40 80 /test1 36136 100000 200000 124 10000 20000 /test2 44064 200000 400000 4 2000 4000 /test3 3587 30000 60000 628 3000 5000 /test4 51071 150000 300000 6 1050 1800 /test5 61044 100000 200000 3 10000 20000
3.2.4.4 Verifying Quota Consistency
The
quotacheck
command verifies that actual block use and
number of files are consistent with the established limits.
It examines user and group
files, builds a table of current disk usage, and compares this table with that stored
in the disk quota file.
If any inconsistencies are detected, AdvFS updates both the
quota file(s) and the current system copy.
If you do not activate quotas automatically at system startup (see
Section 3.2.5),
it is a good practice to run the
quotacheck
command when quotas
are first activated (see
Section 3.2.6).
To ensure accuracy, run
this command when there is no activity on the system.
The
quotacheck
command only checks filesets that have the
userquota
or
groupquota
option specified in the
/etc/fstab
file (see
Section 3.2.2).
By default both user
and group quotas are checked, but you can specify either by selecting the
-u
option for user or the
-g
option for group.
The
quotacheck
command requires that filesets be mounted
with quotas activated.
Select the
-v
option (verbose) to display
inconsistencies found and procedures performed during the checking process.
The following example shows a verbose check of the fileset
set_1
that displays no inconsistencies:
#
quotacheck -v domain_1#set_1
*** Checking user and group quotas for domain_1#set_1 (/test1)
The following example checks all filesets that have quotas defined in the
/etc/fstab
file.
In this example the
quotacheck
command
fixes inconsistencies in
/usr
:
#
quotacheck -va
*** Checking user and group quotas for /dev/rdisk/dsk0g (/usr) *** Checking user and group quotas for domain_1#set_1 (/test1) /usr: root fixed: inodes 3057 -> 3022 blocks 100616 -> 123440 /usr: system fixed: inodes 2483 -> 2488 blocks 91721 -> 114568 /usr: adm fixed: inodes 280 -> 240 blocks 487 -> 464
In this display,
inodes
is the number of files andblocks
is the block usage.
3.2.4.5 Summarizing Quotas by Fileset
The
repquota
command displays the actual disk usage and
quotas for the specified filesets.
To be included in the summary, the fileset must
have a quota entry in the
/etc/fstab
file.
By default both user
and group quotas are reported, but you can specify either by using the
-u
option for user or the
-g
option for group.
For each user or group, the
repquota
command prints the current
number of files, the amount of space used, and the quota limits established with the
edquota
command.
The following example summarizes quotas for a single fileset mounted on
/test1
:
#
repquota -v /test1
*** Report for user quotas on /test1 (domain_1#set_1) Block limits File limits User used soft hard grace used soft hard grace root -- 34088 0 0 123 0 0 user5 -- 816 20000 30000 9 350 500
The following example displays user and group quota information for all filesets
in
/etc/fstab
that have quotas defined.
Note that this example
contains both UFS and AdvFS files:
#
repquota -va
*** Report for group quotas on /usr (/dev/disk/dsk0g) Block limits File limits Group used soft hard grace used soft hard grace system -- 114568 0 0 2488 0 0 daemon -- 144 0 0 1 0 0 uucp -- 801 0 0 8 0 0 mem -- 1096 0 0 10 0 0 bin -- 108989 0 0 3219 0 0 mail -- 209 0 0 2 0 0 terminal -- 56 0 0 2 0 0 adm -- 464 0 0 240 0 0 operator -- 392 0 0 3 0 0 211 -- 6937 0 0 33 0 0 *** Report for user quotas on /usr (/dev/disk/dsk0g) Block limits File limits User used soft hard grace used soft hard grace root -- 123440 0 0 3022 0 0 bi -- 102534 0 0 2940 0 0 uucp -- 729 0 0 7 0 0 adm -- 1 0 0 1 0 0 user5 -- 15 18 24 1 0 0 kraetsch -- 6937 0 0 35 0 0 *** Report for group quotas on /test1 (domain_1#set_1) Block limits File limits Group used soft hard grace used soft hard grace system -- 22816 0 0 50 0 0 daemon -- 12088 0 0 82 0 0 *** Report for user quotas on /test1 (domain_1#set_1) Block limits File limits User used soft hard grace used soft hard grace root -- 34088 0 0 123 0 0 user5 -- 816 20000 30000 9 350 500 *** Report for group quotas on /test3 (domain_2#set_1) Block limits File limits Group used soft hard grace used soft hard grace system -- 1593 0 0 6 0 0 *** Report for user quotas on /test3 (domain_2#set_1) Block limits File limits User used soft hard grace used soft hard grace root -- 1593 0 0 6 0 0
3.2.5 Activating Quotas at System Startup
You can automatically start user and group quota enforcement during system
initialization by modifying the
/etc/rc.config
option.
Edit the
QUOTA_CONFIG
option to read:
QUOTA_CONFIG=
YES
This entry causes the
/sbin/init.d
quota script to run the
quotaon
and
quotacheck
commands.
Then, edit the
/etc/fstab
file entry to add
userquota
and
groupquota
to the mount point.
Quota enforcement
is activated for the mounted fileset the next time and every time you reboot.
For example, if you wanted to activate a quota on the fileset
WA
in the file domain
expenses
, the
/etc/fstab
entry would be:
expenses#WA /WA advfs rw,userquota,groupquota 0 2
Note
If you unmount a fileset when quota enforcement is active, you must explicitly reactivate quota enforcement with the
quotaon
command when you remount the fileset. This must be done even if there is aQUOTA_CONFIG=YES
entry.
3.2.6 Activating Quotas Manually
If your system is running, enter the
quotaon
command to activate
new quotas for a mounted fileset.
To establish new user or group quotas do the following:
Edit the
/etc/fstab
file entry for your fileset
to add
userquota
and
groupquota
to the mount
point.
Run the
edquota
command to enter the hard and
soft limits and to enter the grace period.
Run the
quotaon
command to activate the quotas
you have chosen.
If your system is set up to initialize quotas (see
Section 3.2.5),
you do not need to run the
quotaon
command again unless you have
unmounted your fileset.
If you have initialized your system without quota enforcement,
you must run the
quotaon
command to start enforcement each time
you reboot.
The following example activates quotas for the filesets for which quota values were set in the previous sections:
#
quotaon -av
/test1: group quotas turned on /test1: user quotas turned on /test3: group quotas turned on /test3: user quotas turned on /test4: group quotas turned on /test4: user quotas turned on
By default, both user and group quotas are affected by the
quotaon
and
quotaoff
commands.
You can choose to activate quotas
either for users (with the
-u
option) or for groups (with the
-g
option).
You can also specify the filesets for which user or group quotas
will be enforced (see
Section 3.3.5
for information on fileset
quotas).
3.2.7 Deactivating Quotas
You can turn off quota enforcement either temporarily or permanently. You can obtain file and disk space usage information regardless of whether you are enforcing quotas.
The
quotaoff
command turns off quota enforcement until the
quotaon
command is run again either manually or through system initialization
that turns quotas on.
The
umount
command turns off quotas before it unmounts a
fileset.
If you remount the fileset, you must run the
quotaon
command
to enforce user and group quotas for the fileset.
If you want to permanently turn quotas off for a user or group, use the
edquota
command to set quota limits to 0 (zero).
To prevent quotas from
ever being activated for a fileset, run the
quotaoff
command.
Then,
remove the
userquota
and
groupquota
entries
for the fileset in the
/etc/fstab
file.
3.3 Fileset Quotas
The following sections describe fileset quota files and how quotas and grace
periods are set for filesets from the command line.
For information on setting fileset
quotas from the AdvFS GUI, see
Chapter 6.
3.3.1 Quota Files
AdvFS keeps fileset soft and hard limits in the structural information associated
with the fileset.
You do not have direct access to this file.
It contains the same
type of information that the user and group quota files contain: hard and soft limits
for number of blocks and hard and soft limits for number of files.
For a given fileset,
the fileset grace period is the same as the group grace period.
3.3.2 Setting Quotas and Grace Periods
Fileset quotas limit the number of files or the amount of disk space a fileset
can use.
You can set both soft and hard limits.
If fileset quotas are not imposed,
any fileset has access to all of the available disk space in the file domain.
The
fileset quotas are set with the
chfsets
command.
If fileset quotas
are set, they are activated whenever you mount the fileset.
The fileset grace period is the same as the group grace period (see Section 3.3.2.2). If you do not set a grace period, the grace period remains at the AdvFS default grace period of 7 days.
Use the
chfsets
command to define fileset quota values.
You
can set a soft limit for the number of files (-F
option), a hard
limit for the number of files (-f
option), a soft limit for block
usage (-B
option), and a hard limit for block usage (-b
option).
The command displays both the old and new limits.
3.3.2.1 Fileset Quotas Example
The following example sets fileset quotas for the
set_1
fileset indmn_2
.
Note that unlike the quota commands, the
showfsets
command displays block usage in 512-byte blocks.
If you wish to display kilobyte values,
use the
-k
option.
To display existing fileset quotas, use the
showfsets
command:
#
showfsets dmn_2 set_1
set_1 Id : 2feff762.00034e3f.1.8001 Clone is : set_1_clone Files : 7, SLim= 0, HLim= 0 Blocks (512) : 118, SLim= 0, HLim= 0 Quota Status : user=on group=on
Here
SLim
is the soft limit and
HLim
is the hard limit for the number of files (Files
) and the current
block usage (Blocks
).
Use the
chfsets
command to set the quotas.
Note
that the arguments for block usage for the
chfsets
command are
in units of 1 kilobyte, not 512 bytes as shown by the
showfsets
command display.
#
chfsets -F 10000 -f 20000 -B 250000 - b 500000 dmn_2 set_1
set_1 Id : 2feff762.00034e3f.1.8001 File H Limit : 0 ==> 20000 Block H Limit: 0 ==> 500000 File S Limit : 0 ==> 10000 Block S Limit: 0 ==> 250000
Here
File H Limit
is the hard limit for the number of files,
Block H Limit
is the hard limit for block usage,
File S Limit
is the soft limit for the number of files, and
Block S Limit
is
the soft limit for block usage.
To verify the new fileset quotas, run the
showfsets
command again:
#
showfsets dmn_2 set_1
set_1 Id : 2feff762.00034e3f.1.8001 Clone is : set_1_clone Files : 7, SLim= 10000, HLim= 20000 Blocks (512) : 118, SLim= 500000, HLim= 1000000 Quota Status : user=on group=on
Note that the soft limit for the number of blocks is 500000, twice the number
250000 that was input with the
chfsets
command; similarly, the
hard limit for the number of blocks appears to double from 500000 to 1000000.
To avoid
this confusion, enter the
showfsets
command with the
-k
option to display blocks in 1-kilobyte units.
3.3.2.2 Setting the Grace Period
The fileset grace period is the same as the group grace period and cannot be
modified independently (see
Section 3.2.2).
Therefore, if you use the
edquota -gt
command to change the grace period for which a fileset can exceed
its soft limits, you will also change the group grace period and vice versa.
The default
AdvFS grace period of 7 days remains in effect until you change it.
You can set only one grace period per fileset, but you can set different grace period values for block usage and number of files. The grace period applies to all users and all groups. If the grace period is reset, the new grace period for the fileset takes effect immediately unless the fileset has already exceeded its soft limits. In that case, the new grace period becomes effective once the fileset drops below the soft limit.
The following example sets the grace period for the filesets
test1
,
test3
, and
test4
:
Run the
edquota
command with the group grace period
options.
The command creates a temporary file with an ASCII representation of the
current grace period and invokes an editor to allow you to modify the file:
#
edquota -gt
Time units may be: days, hours, minutes, or seconds Grace period before enforcing soft limits for groups: /test1: block grace period: 7 days,file grace period:7 days /test3: block grace period: 7 days,file grace period:7 days /test4: block grace period: 7 days,file grace period:7 days
To change the fileset grace period for the number of blocks and for the number of files, edit the file to change the existing grace period:
Time units may be: days, hours, minutes, or seconds Grace period before enforcing soft limits for groups: /test1: block grace period: 7 days, file grace period:7 days /test3: block grace period:12
hours, file grace period:5
days /test4: block grace period: 7 days, file grace period:7 days
Exit the editor, saving the changes.
Run the
showfsets
command with the
-q
option to see the time (if exceeded) and fileset usage and limits:
#
showfsets -q test_domain
Block (512) Limits File Limits Fileset BF used soft hard grace used soft hard grace fileset1 +- 1750 1500 2000 11:32 35 300 400
In this example, the plus sign (+) in the
BF
field means
that the soft limit for block usage is exceeded.
An asterisk (*) indicates that the
hard limit has been reached.
3.3.3 Setting Quotas for Multiple Filesets
You can set quota limits for multiple filesets by listing more than one fileset
name when you run the
chfsets
command (see
Section 3.3.2).
For example, to change the hard limits for the
data
and
data2
filesets in
test1_domain
, enter the names of both
filesets after the
chfsets
command:
#
chfsets -b 1000 -f 200 test1_domain data data2
data Id : 2fdf591b.000855fa.2.8001 File H Limit : 11 ==> 200 Block H Limit: 121 ==> 1000 data2 Id : 2fdf591b.000855fa.3.8001 File H Limit : 50 ==> 200 Block H Limit: 200 ==> 1000
Setting fileset quotas automatically activates the quotas.
3.3.4 Verifying File and Disk Space Usage
To examine how system resources are being used, look at fileset activity.
Table 3-3
contains commands that are useful for examining disk
space and the file usage of filesets.
Table 3-3: Fileset Disk Usage Commands
Command | Description |
df |
Displays disk space used and available disk space for a fileset |
showfdmn |
Displays the attributes of a file domain |
showfsets |
Displays the attributes of filesets in a file domain |
vdf |
Displays disk space used and available disk space for a fileset or a file domain |
See
the command reference pages for more information.
3.3.4.1 Displaying Used and Available Disk Space for Filesets
You can display the available disk space and the disk space used for a fileset
with the
df
command (see
Section 3.3.4.2
for file
domain information).
The command calculates capacity using the lower (hard or soft)
limit for the amount of space available:
If a fileset quota has been set, the command displays the amount of space remaining until the quota limit is reached.
When both soft and hard quota limits are set, the command calculates the disk space available using the lower limit.
If there is less space in the domain than is allowed by the fileset quota, the command displays the actual space available in the file domain.
If fileset quotas have not been established, the command displays the available domain size; all unused space is available to each fileset.
The following example displays the amount of space available for
fileset_1
:
#
df /fileset_1
Filesystem 512-blocks Used Avail Capacity Mounted on test_domain#fileset_1 1500 1750 0 117% /fileset_1
Because the usage is over the limit, the capacity is determined by the actual space used (1750/1500) and appears as more than 100%. If usage is not over the limit, capacity is calculated as (used)/(used + available).
AdvFS calculates each fileset capacity independently.
If the domain has multiple
filesets, all unused space is available for each fileset unless the space is limited
by fileset quotas.
As a result, the total capacity of all filesets in the domain may
appear to be greater than 100%.
In the following example, the filesets
domain_1#test3
and
domain_1#test4
each can use all of the available
disk space from the volumes in
domain_1
:
#
df
Filesystem 512-blocks Used Avail Capacity Mounted on domain_1#test3 2000000 390820 98864 80% /test3 domain_1#test4 2000000 271580 98864 73% /test4
3.3.4.2 Displaying Used and Available Disk Space for File Domains and Filesets
The
vdf
utility reformats output from the
showfdmn
,
showfsets
,
shfragbf
, and
df
commands to display information about the disk usage of AdvFS file domains
and filesets.
It clarifies the relationship between a domain's disk usage and its
fileset's disk usage.
The utility is subject to the following restrictions:
All filesets in a file domain must be mounted if you want to calculate disk usage of the domain.
Disk space used by clone filesets is not calculated.
The command does not produce valid results for filesets that are NFS mounted.
You can specify either a file domain or a fileset name for the
vdf
command.
If you specify only a fileset name, the output is the same as
that of the
df
command.
If you specify a file domain, the utility
also displays the number of disk blocks used for metadata.
If you specify the
-l
option with either a file domain or a fileset, both domain and fileset
information will be displayed.
The domain metadata displayed is the total metadata
shared by all filesets in the file domain.
The following example shows the summary information for the file domain
usr_domain
:
#
vdf usr_domain
Domain 512-blocks Metadata Used Available Capacity usr_domain 65536 11219 47549 6768 89%
The following example examines the domain
test
that contains
two filesets.
Each has a quota limit of 60,000 blocks.
#
vdf -l test
Domain 512-blocks Metadata Used Available Capacity test 266240 5824 29128 231288 13% Fileset QuotaLimit Used Available Capacity testfs 60000 20800 39200 35% testfs2 60000 8328 51672 14%
The following example shows the domain
test
that contains
two filesets with no quota limits.
In this case, the total space available to each
fileset is the same as the domain total.
#
vdf -l test
Domain 512-blocks Metadata Used Available Capacity test 266240 5824 29128 231288 13% Fileset QuotaLimit Used Available Capacity testfs - 20800 231288 35% testfs2 - 8328 231288 14%
3.3.4.3 Displaying Fileset Attributes
The
showfsets
command with the
-q
option
shows file usage, hard and soft limits, and grace period information for the filesets
in the specified domain.
It shows the block usage, the block usage limit, the number
of files, and the file limit.
The correct information will be displayed only if the
fileset is mounted.
The following example shows fileset information for the domain
test_domain
:
#
showfsets -q test_domain
Block (512) Limits File Limits Fileset BF used soft hard grace used soft hard grace fileset1 +- 1750 1500 2000 11:32 35 300 400
In this
example, the plus sign (+) in the
BF
field means that the soft
limit for block usage is exceeded.
An asterisk (*) would indicate that the hard limit
has been reached.
3.3.4.4 Displaying File Domain Attributes
The
showfdmn
command is useful for obtaining file domain
statistics to make decisions about filesets and their quotas.
The command shows the
attributes of a file domain and information about each volume in the domain.
For single-volume
or multivolume file domains, the command shows the total volume size, the total number
of free blocks, and the total percentage of volume space currently allocated.
3.3.5 Activating Quotas
Running the
chfsets
command automatically activates fileset
quotas immediately (see
Section 3.3.3).
No further steps are
needed.
Fileset quotas are in effect whenever you mount the fileset.
3.3.6 Deactivating Quotas
You can turn off quota enforcement either temporarily or permanently by running
the
chfsets
command with the hard and soft limits set to 0 (zero)
to deactivate quotas on a fileset.
You can obtain file and disk space usage information
regardless of whether you are enforcing quotas.