quotactl
Administer filesystem disk quotas
Syntax:
quotactl mountpoint command [command-options]
Options:
Mountpoint
The mountpoint is the root directory of the target pathname space managed by the filesystem (e.g., /fsys/data).
Commands
- ON [-0|-1] [-t args]
- Enable quotas for the specified filesystem.
This command creates the quota database and starts the monitoring of all per-ID file usage and
total block allocation (i.e., total size of files).
You can set a grace period during which soft limits for filesystem usage quotas may be exceeded;
hard limits are enforced immediately. For more information, see the -t option description.
When the ON command is issued, no limits for specific IDs are in effect; to configure them, use EDIT.
- OFF
- Disable quotas for the specified filesystem. This command removes the quota database and stops the monitoring of per-ID file and block usage.
- QUERY
- Report the current status of quotas for the filesystem. Possible values are on, off, or unsupported. The value unsupported applies if the target is not a QNX6 filesystem.
- EDIT [-0|-1] [-hn] [-t args] [-p default_limits] [-u UIDs limits]* [-g GIDs limits]*
- Adjust (set, change, delete) the quota limits of particular users or groups on the filesystem.
If you specify user or group IDs through command options, the quota limits that you provide in the same
EDIT command are immediately applied to these IDs only.
For the syntax and semantics of specifying the IDs and quota limits, refer to
Options:
.If you don't specify any IDs when issuing this command, quotactl gathers the current quota limits and filesystem usage data into a temporary text file using READ -v and opens that file for editing. In this interactive mode, you can adjust the limits on the number of files and total file sizes for particular IDs. You can also add or remove lines for particular IDs. In the text file, individual limit values must be separated by normal spaces, tabs, or newlines. Unlike with the quotactl command options, colons (
:
) aren't used. When you finish editing and save the file, quotactl parses it and tries to apply the new set of limits.If quotactl encounters any invalid lines in the saved text file or invalid command option settings (e.g., due to typos), quotactl reports an error and doesn't apply any updates.
- READ [-hnstv] [-u UID]* [-g GID]*
- Report the current quota limits and filesystem usage. The output is written to stdout. You can filter the output by specifying user ID (UID) and/or group ID (GID) values and adjust how the information is shown. For more information, refer to the command options below. If you don't provide IDs, the quota limits and filesystem usage data are shown for all IDs that have quotas.
Command options
Applies tolist at the start of any option description to know which commands apply to which options.
- -0
- Applies to: ON, EDIT
Set a global default value of zero (0) for all hard filesystem usage limits. A global default value applies to any ID (user or group) that doesn't have explicitly defined limits. A zero value means no limit, and, therefore, unlimited filesystem use is permitted. In this case, the soft limits aren't relevant.
This option is mutually exclusive with the -1 option. If you set both, the last (rightmost) one in the command string applies. If you set neither, quotactl uses built-in default values of zero for all limits, which is equivalent to setting -0.
You can set this option with the ON command to make it clear in your configuration that all IDs initially have unlimited file creation and block allocation (i.e., file size) capabilities. You can set it with EDIT to ensure that after the command is processed, all IDs without explicit limits are granted unlimited filesystem usage.
- -1
- Applies to: ON, EDIT
Set a global default value of minus one (-1) for all hard filesystem usage limits. A global default value applies to any ID (user or group) that doesn't have explicitly defined limits. A value of minus one means no filesystem usage is permitted. In this case, the soft limits aren't relevant.
This option is mutually exclusive with the -0 option. If you set both, the last (rightmost) one in the command string applies.
If you set the -1 option with the ON command, any ID without explicit limits is prevented from creating files or allocating blocks for them (i.e., increasing their size) provided there's at least one ID that has an explicit limit; the remaining IDs are denied any filesystem usage. Imposing an initial restriction of any filesystem usage for all IDs would prevent the system from doing anything.
You can set this option with EDIT to ensure that after the command is processed, any ID without explicit limits is denied any filesystem usage.
- -g first_id[-last_id][:soft_inodes_limit:hard_inodes_limit:soft_filesize_limit:hard_filesize_limit]
- Applies to: EDIT
Adjust the quota limits for the specified GIDs. You can specify one GID (
first_id
) to indicate only that group, or a GID range (first_id-last_id
) to indicate several groups.The -g option arguments are parsed so quotactl can learn of any new soft and hard limits for the number of file entries (inodes) and number of block allocations (i.e., total size of files). If the parsing succeeds, these limits are applied for the specified GIDs.
The quota limits must be given as four numeric values separated from each other and from the GIDs by colons (
:
). If the -h option is also set, each value can be followed by a unit suffix. For more information, see the -h description.If you don't provide any limit arguments, the quotas for the specified GIDs are reset to their default values. These values are either the limits defined by the -p option (which apply to all -g and -u arguments in this invocation) or the global default limits, in which case the quotas are removed.
- -g first_id[-last_id]
- Applies to: READ
Display the quota limits for the specified GIDs. You can specify one GID (
first_id
) to indicate only that group, or a GID range (first_id-last_id
) to indicate several groups.Note:You must not provide any limit arguments for this option with READ, or quotactl fails with an error. - -h
- Applies to: EDIT, READ
Use a human-readable form for the filesystem usage limits to indicate the size units.
This option affects the output of READ and, therefore, the contents of the temporary text file generated by EDIT when the command is issued without IDs. For example, for file sizes, quotactl shows 10M for 10 megabytes. Without this option, it shows file sizes in their default measurement of kilobytes but without the unit suffix (e.g., 512 means 512k). Kilobytes are the default unit because disk blocks are allocated several kilobytes at a time and thus, this unit choice is the historical standard for UNIX systems.
For an EDIT command issued with IDs, setting the -h option tells quotactl to handle unit suffixes for any soft and hard limit values. Each suffix is one letter, case-insensitive, and may be any of:k
(kilo)M
(mega)G
(giga)T
(tera)
For numbers of inodes, the suffixes represent powers of ten instead of powers of two. For instance,
kilo
means 1000 (not 1024) and thus, a2k
soft or hard limit for number of inodes means the associated ID can create up to 2000 file entries (i.e., files, directories, symbolic links, or hard links). - -n
- Applies to: EDIT, READ
Use numeric IDs for users and groups when displaying quota limits. By default, quotactl displays the user and group names from the passwd files.
This option affects the output of READ and, thus, the contents of the temporary text file generated by EDIT when the command is issued without IDs. In the latter case, you are expected to enter numeric IDs, rather than user and group strings used by passwd, when adjusting the quota limits in interactive mode.
- -p soft_inodes_limit:hard_inodes_limit:soft_filesize_limit:hard_filesize_limit
- Applies to: EDIT
Set default quota limits for the IDs given in the -u and -g options. The -p option is provided for convenience, because it lets you override the default limits for multiple IDs and saves you from typing in new limits for each of them.
The quota limits must be given as four numeric values separated from each other by colons (
:
). If the -h option is also set, each value can be followed by a unit suffix. For more information, refer to the -h description.Note:The rules by which quotactl applies quota limits to a specific ID are as follows:- A temporary quota limit record is created based on the current global -0 or -1 setting. If -0 is set, the record is 0:0:0:0 (i.e., the default is to allow for unlimited filesystem usage). If -1 is set, the record is -1:-1:-1:-1 (i.e., the default is to deny any filesystem usage).
- If -p is specified, then this temporary record is replaced with the quota limits given by this option.
- Then, for each explicit -u and -g specified, an EDIT quota limit record is made, as a copy of what came out of applying the above two rules, and overridden with any limit fields given with that -u or -g. The resulting record is then applied to that one ID.
- -s
- Applies to: READ, EDIT in interactive mode
Don't sort by UID/GID; instead, display in the order the quotas were created.
- -t inodes_grace_period:files_size_grace_period
- Applies to: ON, EDIT
Set the grace periods for any soft limits on the number of file entries (inodes) and the number of block allocations (i.e., total size of files) allowed for any ID. Here, inodes means files, directories, symbolic links, or hard links. During the grace period, an ID's filesystem usage can exceed these soft limits; hard limits are enforced immediately.
You can specify different values for these two soft limits, separated by a colon (:). The default time unit is seconds, meaning that if you don't specify a unit, quotactl interprets a time value as seconds. You can add the following one-letter, case-insensitive unit suffixes:d
(days)h
(hours)m
(minutes)s
(seconds)
If you don't provide the -t option, the default setting for each soft limit is 1 day. For an explanation of soft limits and how they differ from hard limits, see
Managing disk quotas
in the QNX OS User's Guide. - -t
- Applies to: READ
Display additional information for IDs that are in their grace period. The output shows an extra field, Grace, with the time remaining to reduce usage below a soft limit. The user can infer which soft limit (number of inodes or total size of files) this field is referring to by examining the other fields.
For instance, suppose UID 500 has soft and hard limits of 10 and 20 for the number of inodes, no limits on the total size of all files, and has 15 file entries (inodes). In this case, the time value shown in Grace reflects how long UID 500 has to reduce its number of files to be 10 or fewer before the inodes_grace_period set with -t expires and the lower limit of 10 files is enforced. Note that the time value can have the same suffixes listed above for the ON and EDIT commands.
If the grace period has already expired, the Grace field shows Expired. If the ID has exceeded a hard limit because this limit was reduced to something below its current usage level, the field shows Exceed. If the ID has not exceeded any soft or hard limit, the field is blank.
Note:You must not provide any grace period arguments for this option with READ, or quotactl fails with an error. - -u first_id[-last_id]:[soft_inodes_limit:hard_inodes_limit:soft_filesize_limit:hard_filesize_limit]
- Applies to: EDIT
Adjust the quota limits for the specified UIDs. You can specify one UID (
first_id
) to indicate only that user, or a UID range (first_id-last_id
) to indicate several users.The -u option arguments are parsed so quotactl can learn of any new soft and hard limits for the number of file entries (inodes) and number of block allocations (i.e., total size of files). If the parsing succeeds, these limits are applied for the specified UIDs.
The quota limits must be given as four numeric values separated from each other and from the UIDs by colons (
:
). If the -h option is also set, each value can be followed by a unit suffix. For more information, see the -h description.If you don't provide any limit arguments, the quotas for the specified UIDs are reset to their default values. These values are either the limits defined by the -p option (which apply to all -g and -u arguments in this invocation) or the global default limits, in which case the quotas are removed.
- -u first_id[-last_id]
- Applies to: READ
Display the quota limits for the specified UIDs. You can specify one UID (
first_id
) to indicate only that user, or a UID range (first_id-last_id
) to indicate several users.Note:You must not provide any *_limit arguments for this option with READ, or quotactl fails with an error. - -v
- Applies to: READ
Display additional information about the overall filesystem usage and column labels.
Runs on:
QNX OS
Description:
Use the quotactl utility to manage filesystem disk quotas that limit the number of file entries (inodes) and the total size of files that users or groups can create.
Each filesystem has its own database that stores disk quota information about both users (UIDs) and groups (GIDs). When you issue the quotactl commands to enable or disable quotas for a given filesystem (ON or OFF), its corresponding database gets dynamically created or deleted. The database is stored on the filesystem itself.
There are also commands to report the overall quota status (QUERY); the current limits and filesystem usage (READ); and to adjust the quota limits for particular users and groups (EDIT). This last activity can be done with individual commands or interactively through a temporary text file.
All command names are case-insensitive.
Only the Power-Safe (QNX6) filesystem supports disk quotas.
This filesystem uses its snapshot feature to ensure consistency of the quota database against the actual filesystem usage.
Usage updates to the quota database become part of the filesystem state that transitions from snapshot to snapshot.
For example, creating a file is bundled with the database update of the associated ID owning one more file.
Both pieces of information are committed at the same logical time; or, if a power loss or crash happens, neither are.
This design guarantees consistency because the quota accounting update associated with an operation occurs in the same snapshot
as the operation itself.
For further explanation of the snapshot feature, see the
Required properties of the device
section in the fs-qnx6.so reference.
For details about the semantics of disk quotas,
see Managing disk quotas
in the
QNX OS User's Guide.
Examples:
# quotactl /fsys/data on
# quotactl /fsys/data edit -u101:0:0:0:10000 -u102:0:250:0:0 -g500:100:150:0:0
# quotactl /fsys/data edit -h -u102 -u115:0:500:0:4g
# quotactl /fsys/data edit -h -p0:100:0:128m -u300-320
# quotactl /fsys/data read -hv
FILESYSTEM /q6 (qnx6) 4096-blocksize
Inodes 172k/460k Files 8259M/112G
UID Inodes Soft Hard Files Soft Hard
root 171k 0 1M 4550M 0 100G
300 88 50 100 870M 0 1G
301 44 50 100 676M 500M 1G
In this case, root is well within its limits for number of files and total size of files.
However, UID 300 has exceeded its soft limit for number of files
and UID 301 has exceeded its soft limit on total size.
# quotactl /q6 on -0
# quotactl /q6 edit -u500:0:1:0:1M
# on -u500 touch /q6/tmp/file1
# on -u500 touch /q6/tmp/file2
File size limit exceeded (core dumped)
#
In this example, UID 500 can create one file but not a second file.
# quotactl /q6 on -1
# quotactl /q6 edit -u502:0:10:0:10000
# on -u500 touch /q6/tmp/file
File size limit exceeded (core dumped)
# on -u501 touch /q6/tmp/file
File size limit exceeded (core dumped)
In this example, neither UID 500 nor UID 501 can create a file, because the default quota limits
allow for no usage, and neither UID has its own limits set.