Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

quota(1)

quotactl(2)

vfsmount(2)

edquota(1M)

mount(1M)

quot(1M)

quotacheck(1M)

quotaon(1M)

rquotad(1M)

setprivgrp(1M)

quota(5)

NAME

quota − disk quotas

Remarks

The HP-UX default is to allow chown(2). This can interfere with the disk quota mechanism. See the WARNINGS section, below. 

DESCRIPTION

Disk quotas can be used by the system administrator to limit the number of files and file blocks owned by a user on a per-file system basis.  Only HFS file systems support disk quotas.  Separate limits can be established for both the number of files (inodes) and the number of (1-Kbyte) blocks for each user.  A soft (preferred) and a hard limit are established. 

For example, user joe_doe may have soft limits of 1000 blocks and 200 files and hard limits of 1200 blocks and 300 files on the root file system (/) containing his $HOME directory and /tmp, and soft and hard block limits of 100 and 120, respectively, with no explicit files limit (0) on the mounted file system /mnt. 

A time limit is established for each file system which determines how long a user is allowed to exceed the soft limit.  The default time limit is one week (7 days). 

When a user exceeds his soft limit, a warning is emitted on /dev/tty. The user can continue to increase utilization over the soft limit until he either exceeds the hard limit or the established time limit. Once either of these events occurs, a message is sent to /dev/tty and further attempts at file creation and/or increased block utilization will fail.  At this point, the user must reduce use of the exceeded limit below the soft limit to restore normal operation. 

At login time, users exceeding quota limits are reminded (via login(1)) of exceeded quotas and appropriate remedial action. The user can check current quota status at any time with the quota(1) command.

Quota limits and utilization statistics are maintained by the operating system for each file system for which quotas have been enabled (see mount(1M) and quotaon(1M)).

Disk quotas are established independently for each user and each file system via edquota(1M). This command is also used to establish the limit for the amount of time users are permitted to exceed their soft limit. Default time limit is 1 week.

Limits and usage statistics are stored statically in file quotas on the root of each file system for which they are in effect.  This file is synchronized with information in the kernel by quotactl(2) and whenever an affected file system is unmounted.

Quotas can be enabled automatically at boot (mount) time by adding the quotas option to the option list in /etc/checklist (see checklist(4) and mount(1M)). Note that default mount(1M) behavior is to not enable disk quotas. 

Quotas can subsequently be disabled and reenabled with quotaoff(1M) and quotaon(1M). When disabled, the kernel does not maintain usage statistics and the quotas file usage statistics are invalidated by file system activity.  Disabling quotas improves performance, but necessitates running quotacheck(1M) to update the kernel and quotas file after subsequently reenabling quotas. 

Users with appropriate privileges can obtain reports of current quota statistics with repquota(1M). A somewhat related, but independent command is quot(1M), which collects and reports disk utilization independently of the disk quota subsystem.

The mount(1M) command reports any file systems for which quotas are enabled.

Data Storage Structure

The dqblk data structure (defined in <quota.h>), is used by the quotactl(2) system call to get or set quota information when the command parameter is set to Q_GETQUOTA, Q_SETQUOTA, or Q_SETQLIM.  This structure contains fields that are used to store a user’s current file and block count and quota limits for a particular file system. 

struct dqblk contains the following members:

u_long  dqb_bhardlimit; /* maximum # of disk blocks +1 */
u_long  dqb_bsoftlimit; /* preferred limit on disk blocks */
u_long  dqb_curblocks;  /* current block count */
u_long  dqb_fhardlimit; /* maximum # allocated files +1 */
u_long  dqb_fsoftlimit; /* preferred file limit */
u_long  dqb_curfiles;   /* current # allocated files */
u_long  dqb_btimelimit; /* time limit for excessive block use */
u_long  dqb_ftimelimit; /* time limit for excessive files */

NETWORKING FEATURES

quota(1) is able to report quota statistics on remote NFS file systems for which disk quotas are in effect if the remote system provides the RPC rquotad service. 

rquotad(1M) is provided to allow reciprocal support to other systems.

EXAMPLES

Initial Setup: (performed by user with appropriate privileges)

The kernel must be reconfigured to support disk quotas; see the System Administrator manuals.  Eligible file systems for disk quota enforcement are of type hfs with mount options rw and quota, as described in mount(1M) and checklist(4).

For each file system for which quotas are to be enabled, perform the following tasks:

1.  Mount the file system. 

2.  Add quota to the existing options list in /etc/checklist.  For example, change the string default for the root (/) entry to default,quota. 

3.  Create the quotas file at the root of the file system.  For example, for the /mnt file system, run the command

cpset /dev/null /mnt/quotas 600 root bin

4.  Establish one or more prototype user quotas using edquota(1M). If you want all users on your system to have the same limits as proto_user, use edquota to set those quotas for proto_user, then use the −p option to edquota to replicate those limits for all other users. 

5.  Run quotacheck on the file system to record the current usage statistics. 

Adding a new user

To add a new user to the quota system:

1.  Use edquota(1M) to copy the quotas of an existing user.

2.  Run quotacheck(1M).

Adding a new file system to an established system

Repeat steps 1 through 5 above under Initial Setup for the new file system. 

WARNINGS

Quotas can be defeated if the chown(1) command or the chown(2) system call is accessible to a user. The setprivgrp(1M) command can be used to limit access to the chown(2) system call so that only a specified group of users are permitted to use the chown(1) command or the chown(2) system call. 

The sam(1M) command does not yet support disk quotas. When adding new users or file systems, any desired quotas must be established outside of sam.

HP has added features to the original implementation to ensure correctness of the content of the quotas file when quotas are enabled by mount(1M) and disabled by umount(1M), thus eliminating the need to run quotacheck(1M). These features are ineffective, however, if quotaoff(1M) and quotaon(1M) are used to control quotas.

quotacheck should only be run on a dormant file system to ensure accurate usage information.  The −qv options to fsclean(1M) report on the the current viability of the quotas information.

AUTHOR

Disk Quotas were developed by the University of California, Berkeley, Sun Microsystems, and HP. 

FILES

/etc/checklist default file systems

/etc/mnttab information on mounted file systems

directory/quotas quota statistics static storage for file system.  Where directory is the root of the file system, as specified to mount(1M).

SEE ALSO

quota(1), quotactl(2) vfsmount(2), edquota(1M), mount(1M), quot(1M), quotacheck(1M), quotaon(1M), rquotad(1M), setprivgrp(1M)

Hewlett-Packard Company  —  HP-UX Release 9.0: August 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026