NAME
vzquota - manipulate containers disk quotas
SYNOPSIS
vzquota [quota_options] command quota_id [command_options]
DESCRIPTION
vzquota controls disk quotas for Virtuozzo/OpenVZ container. These are
per-container disk quotas set from Virtuozzo/OpenVZ host system.
The quota_id must be numeric-only identifier. Note, that quota ID is
not the same as container ID (CTID). One container can mount several
filesystems and each of them can have its own quotas.
OPTIONS
Argument command can be one of the following: init, drop, on, off,
setlimit, setlimit2, stat, show.
General
-h Print usage information.
-V Print utility version.
-q Quiet mode. Causes all warning and diagnostic messages to be
suppressed. Only fatal errors are displayed.
-v Verbose mode. Causes vzquota to print debugging messages about
its progress. Multiple -v options increase verbosity. Maximum is
2.
-b Batch mode. in this mode outputs (usually on stat and show
commands) will be in format better suitable for parsing by a
script.
Quota Commands
The following commands are available:
init A necessary preliminary for any other quota command work: create
a new quota file, calculating current disk usage from given
path. This command requires full set of quota soft- and
hardlimits given as command-line options. Limits are also stored
in quota file, so subsequent vzquota on doesn’t requires any
quota limit as command-line parameter, although accepts them as
well. New specified limits and flags will also be stored in the
quota file.
You can also create your own quota files for arbitrary quota
accounting points. Quota file location and path to quota
accounting point can be specified via -c and -p options (see
below). You can use also -R option instead of -c option, to set
relative quota file location. In this case quota file resides
one dirrectory upper than quota accounting point and has special
name (see below).
drop Remove quota file. Command checks if quota is running and
refuses to remove file in this case, option -f allows to
override that rule.
on Turn quota on. If previous quota session wasn’t switched off
properly (quota is not running, but quota file indicates it is),
initialization procedure will be performed. -f option allow to
force initialization procedure regardless of the shutdown
status. Command on doesn’t work in case specified quota id is
running.
off Turn quota off, write usage statistic back to the quota file.
Doesn’t work if quota file cannot be accessed, also accepts -f
option (force switching off, even if usage statistic will be
lost). This is possible that quota will still be in a stopped
state, even if -f flag is used.
setlimit
Set new quota parameters. Requires at least one quota parameter
or flag specified. Applies new parameters immediately if quota
with given quota_id is running. Stores new limits and flags in
the quota file. Option -f specifies to mark quota as dirty, so
at the next quota start, disk will be rescanned and usage
updated.
setlimit2
Set second-level quota parameters. Applies new parameters
immediately if quota with given quota_id is running and second-
level quota is on. Stores new limits in the quota file.
stat Show usage statistics and update it in quota file. Option -f
causes to do not read and update quota file, just print
statistics from kernel. Option -t specifies to show and update
user/group based quota statistics for a container. Works on
running containers only. The command with -t option flushes all
quota statistics from kernel to file and thus may be used for
backup purposes.
show Show usage and limits info from quota file. Option -t specifies
to show user/group quota information as well.
Quota Command Options
Quota limits and flags.
All these options are required in init command, and optionally accepted
in on and setlimit commands.
-s, --sub-quotas 1|0
Enables or disables user/group based quota inside the container.
Here 1 means to enable, and 0 - to disable. By default
user/group quota is disabled. This option is accepted by init
and on commands.
-u user_id
For setlimit2 command only. Limits will be applied to the
specified user_id.
-g group_id
For setlimit2 command only. Limits will be applied to the
specified group_id.
-u, --ugid-limit limit
For on and setlimit commands only. Specifies maximum number of
user and group IDs allowed in the container. If the value is 0,
user/group quota will not be accounted. Default value is 0.
There is one note concerning setlimit command. If first-level
quota is running, second-level quota is active and not all ugid
objects were loaded into kernel by on command due to
insufficient ugid_limit value (this can be checked by issuing
stat -t command and observing whether ugid limit was exceeded),
then setlimit with new limit value updates it in kernel and file
but this change does not take immediate effect. Modification
will be applied after quota restart.
-b, --block-softlimit bsl
Disk quota block soft limit. Soft limit is amount of blocks
which excess is allowed in time equal exptime. On the
expiration of this time soft limit becomes hard limit. Block
limits are set in 1k sized blocks.
-B, --block-hardlimit bhl
Disk quota block hard limit. Hard limit is amount of blocks
which excess is not allowed.
-e, --block-exptime bet
Disk quota expiration time for excess of a block soft limit.
Time can be given in two different formats:
1. dd:hh:mm:ss
For instance: 30 - 30 seconds; 12:00 - 12 minutes; 20:15:11:00 -
20 days, 15 hours, 11 minutes
2. xxA, where A - h/H(hour); d/D(day); w/W(week); m/M(month);
y/Y(year).
For instance: 7D - 7 days; 01w - 1 week; 3m - 3 months
-i, --inode-softlimit isl
Disk quota inode soft limit. Similarly to block soft limit.
-I, --inode-hardlimit ihl
Disk quota inode hard limit.
-n, --inode-exptime iet
Disk quota expiration time for excess of a inode soft limit.
Quota options.
-p path
Point of quota accounting for given quota_id. This option
required for init command and can be used also with any another
command to override quota path obtained from quota file. For on
and setlimit commands, this option can be used to set and save
new quota accounting path for given quota_id
-R Set special relative path to quota_file. If this option is
specified, quota file location will depends on path to quota
accounting dir: if your quota accounting path is
/path/to/somewhere/ than quota file will be
/path/to/quota.somewhere. If this option is not specified, quota
file location is /var/lib/vzquota/quota.quota_id. All commands
accept this option.
-c quota_file
This option allows to specify a quota_file to work with. All
commands accept this option. If this option is not specified,
default file location depends on whether -R option is specified
or not (see above).
-f Force option. Accepted by drop, on, off, stat, setlimit and
setlimit2 commands. Action of this option differs for different
commands and is described above for each command separately.
-t For stat and show commands only. Processes user/group quota
statistics. Specifies whether to show (update in file)
user/group quota information.
-t For setlimit2 command. Set second-level quota time grace
parameters.
LIMITATIONS
It is impossible to start or stop quota accounting if the directory
given by -p option is busy. This is rather limitation of kernel part of
disk quota implementation.
DISPLAY
vzquota stat and vzquota show display the following information:
resource - 1k-blocks or inodes.
usage - current usage of resource.
softlimit - resource limit. Current usage can exceed this limit up to
hard limit during grace time.
hardlimit - resource limit. Current usage can’t exceed this limit.
grace - during this amount of time usage can exceed softlimit. If a
soft limit has not been exceeded the grace column is blank. If the
grace period has expired, the grace column contain special none value.
If -t is specified the following information is displayed also:
User/group quota - on|off, active|inactive. Status of the 2nd level
quota. on|off defines the state of the 2nd level quota at the next
start of container quota. active|inactive indicates the current state
of the 2nd level quota in kernel.
Ugids - loaded, total and limit. loaded is number of records (uids or
gids) in kernel. total is number of unique records located in the
kernel and quota file. limit is current kernel limits of records
amount. loaded and total may be greater then limit.
Ugid limit was exceeded - yes or no. Yes indicates that vzquota did not
loaded all records in kernel. In this case you should reduce number of
unique records (remove files which belong to unnecessary users) or
increase limit. After that you should restart quota.
User/group grace times and quotafile flags - during grace time usage
can exceed softlimit. Quotafile flags are internal parameters of
standard linux kernel quota v.3.
EXIT STATUS
0 Command executed successfully
1 System error
2 Usage error
3 Virtuozzo syscall error
4 Quota file error
5 Quota is already running
6 Quota is not running
7 Can not get lock on this quota id
8 Directory tree crosses mount points
9 Quota is running but user/group quota is inactive; this status
is returned by stat -t command for information purposes and does
not indicate a error
10 Quota is marked as dirty in file; this status is returned by
show command for information purposes and does not indicate a
error
11 Quota file does not exist
12 Internal error
13 Can’t obtain mount point
COPYRIGHT
Copyright (C) 2000-2008, Parallels, Inc. Licensed under GNU GPL.