Managing disk quotas

QNX SDP8.0User's GuideUser

For the Power-Safe (QNX6) filesystem, you can define disk quotas to limit how many file entries a user or group of users can create and how large these files can grow.

A quota limit applies to a particular user or group ID and affects all files that it owns based on the POSIX uid:gid associated with these files when they were created. The creator of a given file is billed against all usage of it by any IDs, unless ownership is reassigned with chown(). Not all IDs need to have quota limits imposed on them, and when they do not, their usage is unlimited (within the filesystem's capacity). When there are both user and group ID quota limits that apply to a file, its usage is constrained by the limit with the smallest value.

This section explains the various types of disk quota limits and their possible settings. You can use the quotactl utility to manage disk quotas for specific IDs. For information about this utility's supported commands and several usage examples, refer to the quotactl entry in the Utilities Reference.

Filesystem usage limits

Quota limits exist for both the number of files and their total size. The number of files, based on file entries (inodes), includes regular files, directories, symbolic links, and hard links, each of which counts as one file against quota usage. Each filesystem data block of a regular file counts as one block against that quota usage; metadata, such as directory content, isn't counted for a particular ID.

When quotas are in effect for a particular ID, all filesystem usage by that ID is dynamically tracked. Each filesystem operation affects usage of its owner user and group IDs in the expected manner: creating a new file counts against the number of files, and appending content to that file increases the total size of all files. Deleting that file releases both usages.

If file permissions allow a non-owner to write to a file, then this is also billed to the file owner(s). If a file is hard-linked, the original owner remains billed for the content usage (even if the original link/filename is later deleted). Reassigning a file's ownership through chown() transfers its quota usage from the old to the new owner(s).

Hard versus soft limits

A quota may contain a hard and a soft limit. A hard limit is absolute and may never be exceeded. A soft limit may temporarily be exceeded during its grace period. For information about setting the grace period, refer to the quotactl reference. Users are expected to restore their usage beneath the soft limit within that period, or else it is enforced as a hard limit. A soft limit allows for occasional burst usage beyond the expected typical usage needs (for example, to construct temporary archive files that may later be compressed or copied off the system).

The filesystem fails any operation that exceeds the hard limit. This failure is indicated by an EDQUOT error and a SIGXFSZ signal against the calling thread. Since the default SIGXFSZ handling is to terminate the process, you should ignore/mask this signal if you intend to handle the error.

There is no immediate notification that an ID has exceeded a soft limit unless the grace period has expired. If this is the case, then the soft limit is enforced as a hard limit.

Special settings

A hard limit of zero (0) means there is no limit in effect (i.e., unlimited usage is permitted). A hard limit of minus one (-1) means no usage is allowed, so that a particular ID cannot create files or allocate disk blocks. Any other value is a specific numeric usage limit.

A soft limit of zero (0) means there is no such limit in effect, and usage is controlled by the hard limit. A soft limit of minus one (-1) means that any usage is temporary for the grace period and that ID must then return to no usage after the grace period. Any other value below the hard limit, if it exists, is a specific usage limit that may be exceeded only temporarily for the grace period.

You can configure limits for one user or group ID, or for a range of IDs as explained in the quotactl reference.

Page updated: