Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > Q

quota(5)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

quota — disk quotas

DESCRIPTION

Disk quotas can be used by the system administrator to limit the number of files and file blocks owned by a user or group on a per-file-system basis. Separate limits can be established for both the number of files (inodes) and the number of 1 KB blocks for each user or group. 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/her HOME directory and /tmp, and soft and hard block limits of 100 and 120, respectively, with no explicit file 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 (seven days).

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

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

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 the edquota command (see edquota(1M)). This command is also used to establish the limit for the amount of time users are permitted to exceed their soft limit. The default time limit is one week.

Limits and usage statistics are stored statically in the 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 the quotactl() system call (see quotactl(2)) and whenever an affected file system is unmounted.

Quotas can be enabled automatically at boot or mount time by adding the quotas option to the option list in /etc/fstab (see fstab(4) and mount(1M)). By default, mount does not enable disk quotas.

Quotas can subsequently be disabled and re-enabled with the quotaoff and quotaon commands (see quotaon(1M)). When quotas are 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 the quotacheck command (see quotacheck(1M)) to update the kernel and quotas file after subsequently re-enabling quotas.

The repquota command (see repquota(1M)) displays reports of current quota statistics. The somewhat related, but independent, quot command (see quot(1M)), collects and reports disk utilization independently of the disk quota subsystem.

The mount command (see mount(1M)) 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() system call (see quotactl(2)) to get or set quota information. 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:

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

The dqblk64 data structure (defined in <quota.h>), is used by the quotactl() system call (see quotactl(2)) to get or set quota information for 64-bit filesystems. 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. Note that VxFS 3.5 will track usage in the dqb64_curblocks field only up to 2 TB.

struct dqblk64 contains the following members:

uint64_t dqb64_bhardlimit; /* maximum # of disk blocks +1 */ uint64_t dqb64_bsoftlimit; /* preferred limit on disk blocks */ uint64_t dqb64_curblocks; /* current block count */ uint64_t dqb64_fhardlimit; /* maximum # allocated files +1 */ uint64_t dqb64_fsoftlimit; /* preferred file limit */ uint64_t dqb64_curfiles; /* current # allocated files */ uint64_t dqb64_btimelimit; /* time limit for excessive block use */ uint64_t dqb64_ftimelimit; /* time limit for excessive files */

NETWORKING FEATURES

Quotas are not fully supported over NFS file systems. However, the quota command 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 (see rquotad(1M)).

rquotad is provided to allow reciprocal support to other systems.

EXAMPLES

Initial Setup

The kernel must be reconfigured to support disk quotas; see the System Administration manuals. Eligible file systems for disk quota enforcement are those with mount options rw and quota, as described in mount(1M) and fstab(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/fstab. For example, change the string default for the root (/) entry to default,quota. Once this is done, quotas will automatically be enabled for all relevant file systems on system reboot.

3.

Create the quotas file in the mount directory 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 the edquota command (see edquota(1M)).

If you want a number of users on your system to have the same limits, use edquota to set those quotas for a prototype user; then use the edquota -p command to replicate those limits for that group of users.

5.

Turn on the quotas on the file system using quotaon. For example, run the command

/usr/sbin/quotaon /mnt

6.

Run quotacheck (see quotacheck(1M)) 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 to copy the quotas of an existing user.

2.

Run quotacheck.

Adding a New File System to an Established System

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

WARNINGS

The HP-UX default is to allow chown(). This can interfere with the disk quota mechanism. Quotas can be defeated if the chown command (see chown(1)) or the chown() system call (see chown(2)) is accessible to a user. The setprivgrp command (see setprivgrp(1M)) can be used to limit access to the chown() system call so that only a specified group of users are permitted to use the chown command or the chown() system call.

The sam command (see sam(1M)) 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 and disabled by umount (see mount(1M)), thus eliminating the need to run quotacheck (see quotacheck(1M)). These features are ineffective, however, if quotaoff and quotaon (see 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 of the fsclean command (see fsclean(1M)) report on the current viability of the quota information.

AUTHOR

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

FILES

/etc/fstab

Static information about the file systems

/etc/mnttab

Mounted file system table

directory/quotas

directory/quota.group

User and group quota statistics static storage for a file system respectively, where directory is the root of the file system, as specified to the mount command (see mount(1M)).

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.