Difference between revisions of "Man/vzquota.8"

From OpenVZ Virtuozzo Containers Wiki
< Man
Jump to: navigation, search
(Automated import of articles *** existing text overwritten ***)
(Automated import of articles *** existing text overwritten ***)
 
(One intermediate revision by the same user not shown)
Line 18: Line 18:
  
 
<p style="margin-left:11%; margin-top: 1em">The
 
<p style="margin-left:11%; margin-top: 1em">The
<b>quota_id</b> must be numeric-only identifier. Note, that
+
<i>command</i> can be one of the following: <b>init</b>,
 +
<b>drop</b>, <b>on</b>, <b>off</b>, <b>setlimit</b>,
 +
<b>setlimit2</b>, <b>reload2</b>, <b>stat</b>,
 +
<b>show</b>.</p>
 +
 
 +
<p style="margin-left:11%; margin-top: 1em">The
 +
<i>quota_id</i> must be numeric-only identifier. Note, that
 
quota ID is not the same as container ID (CTID). One
 
quota ID is not the same as container ID (CTID). One
 
container can mount several filesystems and each of them can
 
container can mount several filesystems and each of them can
Line 24: Line 30:
  
 
== OPTIONS ==
 
== OPTIONS ==
 
<p style="margin-left:11%; margin-top: 1em">Argument
 
<i>command</i> can be one of the following: <b>init</b>,
 
<b>drop</b>, <b>on</b>, <b>off</b>, <b>setlimit</b>,
 
<b>setlimit2</b>, <b>stat</b>, <b>show</b>.</p>
 
  
 
=== General ===
 
=== General ===
Line 87: Line 88:
  
 
=== Quota Commands ===
 
=== Quota Commands ===
 +
 +
<p style="margin-top: 1em">The following commands are
 
available:</p>
 
available:</p>
  
Line 180: Line 183:
 
given quota_id is running and second-level quota is on.
 
given quota_id is running and second-level quota is on.
 
Stores new limits in the quota file.</p>
 
Stores new limits in the quota file.</p>
 +
 +
<p style="margin-left:11%;"><b>reload2</b></p>
 +
 +
<p style="margin-left:22%;">Reload second-level quota
 +
limits from quota file for given quota_id.</p>
  
 
<table width="100%" border="0" rules="none" frame="void"
 
<table width="100%" border="0" rules="none" frame="void"
Line 212: Line 220:
 
</table>
 
</table>
  
=== Quota Command Options ===
+
=== Setting quota limits ===
flags.</b> <br>
+
 
All these options are required in <b>init</b> command, and
+
<p style="margin-top: 1em">All these options are required
optionally accepted in <b>on</b> and <b>setlimit</b>
+
in <b>init</b> command, and optionally accepted in <b>on</b>
commands.</p>
+
and <b>setlimit</b> commands.</p>
  
<p style="margin-left:11%;"><b>&minus;s</b>,
+
<p style="margin-left:11%;"><b>&minus;s</b>,&nbsp;<b>--sub&minus;quotas&nbsp;1</b>|<b>0</b></p>
<b>--sub&minus;quotas 1</b><i>|</i><b>0</b></p>
 
  
 
<p style="margin-left:22%;">Enables or disables user/group
 
<p style="margin-left:22%;">Enables or disables user/group
 
based quota inside the container. Here <b>1</b> means to
 
based quota inside the container. Here <b>1</b> means to
 
enable, and <b>0</b> - to disable. By default user/group
 
enable, and <b>0</b> - to disable. By default user/group
quota is disabled. This option is accepted by <b>init</b>
+
quota is disabled. This option is accepted by <b>init</b>,
and <b>on</b> commands.</p>
+
<b>on</b> and <b>setlimit</b> commands.</p>
  
<p style="margin-left:11%;"><b>&minus;u</b>
+
<p style="margin-left:11%;"><b>&minus;u&nbsp;</b><i>user_id</i></p>
<i>user_id</i></p>
 
  
 
<p style="margin-left:22%;">For <b>setlimit2</b> command
 
<p style="margin-left:22%;">For <b>setlimit2</b> command
Line 234: Line 240:
 
<i>user_id</i>.</p>
 
<i>user_id</i>.</p>
  
<p style="margin-left:11%;"><b>&minus;g</b>
+
<p style="margin-left:11%;"><b>&minus;g&nbsp;</b><i>group_id</i></p>
<i>group_id</i></p>
 
  
 
<p style="margin-left:22%;">For <b>setlimit2</b> command
 
<p style="margin-left:22%;">For <b>setlimit2</b> command
Line 308: Line 313:
 
excess of a inode soft limit.</p>
 
excess of a inode soft limit.</p>
  
<p style="margin-left:11%;"><b>Quota options. <br>
+
=== Other options ===
&minus;p</b> <i>path</i></p>
+
 
 +
<p style="margin-left:11%;"><b>&minus;p&nbsp;</b><i>path</i></p>
  
 
<p style="margin-left:22%;">Point of quota accounting for
 
<p style="margin-left:22%;">Point of quota accounting for
Line 339: Line 345:
 
</table>
 
</table>
  
<p style="margin-left:11%;"><b>&minus;c</b>
+
<p style="margin-left:11%;"><b>&minus;c&nbsp;</b><i>quota_file</i></p>
<i>quota_file</i></p>
 
  
 
<p style="margin-left:22%;">This option allows to specify a
 
<p style="margin-left:22%;">This option allows to specify a
Line 397: Line 402:
 
<p style="margin-left:11%; margin-top: 1em"><b>vzquota
 
<p style="margin-left:11%; margin-top: 1em"><b>vzquota
 
stat</b> and <b>vzquota show</b> display the following
 
stat</b> and <b>vzquota show</b> display the following
information:</p>
+
information: <b><br>
 +
resource</b></p>
 +
 
 +
<p style="margin-left:22%;">Either 1k-blocks or inodes.</p>
 +
 
 +
<table width="100%" border="0" rules="none" frame="void"
 +
      cellspacing="0" cellpadding="0">
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="7%">
  
<p style="margin-left:11%; margin-top: 1em"><b>resource</b>
+
<p><b>usage</b></p></td>
- 1k-blocks or inodes.</p>
+
<td width="4%"></td>
 +
<td width="40%">
  
<p style="margin-left:11%; margin-top: 1em"><b>usage</b> -
+
<p>Current usage of resource.</p></td>
current usage of resource.</p>
+
<td width="38%">
 +
</td></tr>
 +
</table>
  
<p style="margin-left:11%; margin-top: 1em"><b>softlimit</b>
+
<p style="margin-left:11%;"><b>softlimit</b></p>
- resource limit. Current usage can exceed this limit up to
 
hard limit during grace time.</p>
 
  
<p style="margin-left:11%; margin-top: 1em"><b>hardlimit</b>
+
<p style="margin-left:22%;">Resource limit. Current usage
- resource limit. Current usage can&rsquo;t exceed this
+
can exceed this limit up to hard limit during grace
limit.</p>
+
time.</p>
 +
 
 +
<p style="margin-left:11%;"><b>hardlimit</b></p>
 +
 
 +
<p style="margin-left:22%;">Resource limit. Current usage
 +
can&rsquo;t exceed this limit.</p>
 +
 
 +
<table width="100%" border="0" rules="none" frame="void"
 +
      cellspacing="0" cellpadding="0">
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="7%">
 +
 
 +
<p><b>grace</b></p></td>
 +
<td width="4%"></td>
 +
<td width="78%">
 +
 
 +
<p>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 <b>none</b> value.</p></td></tr>
 +
</table>
 +
 
 +
<p style="margin-left:11%; margin-top: 1em">In case option
 +
<b>&minus;t</b> is specified, the following information is
 +
also displayed: <b><br>
 +
User/group quota:</b></p>
 +
 
 +
<p style="margin-left:22%;">Status of the 2nd level quota.
 +
This can be <b>on</b> or <b>off</b>, <b>active</b> or
 +
<b>inactive</b>. Values <b>on</b>/<b>off</b> define the
 +
state of the 2nd level quota at the next start of container
 +
quota. Values <b>active</b>/<b>inactive</b> indicate the
 +
current state of the 2nd level quota in the kernel.</p>
 +
 
 +
<table width="100%" border="0" rules="none" frame="void"
 +
      cellspacing="0" cellpadding="0">
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="9%">
  
<p style="margin-left:11%; margin-top: 1em"><b>grace</b> -
+
<p><b>Ugids:</b></p></td>
during this amount of time usage can exceed softlimit. If a
+
<td width="2%"></td>
soft limit has not been exceeded the grace column is blank.
+
<td width="78%">
If the grace period has expired, the grace column contain
 
special <b>none</b> value.</p>
 
  
<p style="margin-left:11%; margin-top: 1em">If
+
<p>Three values are shown: <i>loaded</i>, <i>total</i> and
<b>&minus;t</b> is specified the following information is
+
<i>limit</i>. <i>loaded</i> is the number of records (uids
displayed also:</p>
+
or gids) in the kernel. <i>total</i> is the number of unique
 +
records located in the kernel and quota file. <i>limit</i>
 +
is the current kernel limit of records amount. Note that
 +
<i>loaded</i> and <i>total</i> may be greater then
 +
<i>limit</i>.</p> </td></tr>
 +
</table>
  
<p style="margin-left:11%; margin-top: 1em"><b>User/group
+
<p style="margin-left:11%;"><b>Ugid limit was
quota</b> - on|off, active|inactive. Status of the 2nd level
+
exceeded:</b></p>
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.</p>
 
  
<p style="margin-left:11%; margin-top: 1em"><b>Ugids</b> -
+
<p style="margin-left:22%;">Can be <b>yes</b> or <b>no</b>.
<i>loaded</i>, <i>total</i> and <i>limit</i>. <i>loaded</i>
+
<b>yes</b> indicates that vzquota did not loaded all records
is number of records (uids or gids) in kernel. <i>total</i>
+
into the kernel. In this case you should reduce the number
is number of unique records located in the kernel and quota
+
of unique records (remove files which belong to unnecessary
file. <i>limit</i> is current kernel limits of records
+
users) or increase the ugid limit. After that you should
amount. <i>loaded</i> and <i>total</i> may be greater then
+
restart quota.</p>
<i>limit</i>.</p>
 
  
<p style="margin-left:11%; margin-top: 1em"><b>Ugid limit
+
<p style="margin-left:11%;"><b>User/group grace times and
was exceeded</b> - yes or no. <i>Yes</i> indicates that
+
quotafile flags:</b></p>
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 <i>limit</i>.
 
After that you should restart quota.</p>
 
  
<p style="margin-left:11%; margin-top: 1em"><b>User/group
+
<p style="margin-left:22%;">Grace times and quota file
grace times and quotafile flags</b> - during grace time
+
flags (internal parameters of standard linux kernel quota
usage can exceed softlimit. Quotafile flags are internal
+
v.3).</p>
parameters of standard linux kernel quota v.3.</p>
 
  
== DIAGNOSTICS ==
+
== EXIT STATUS ==
  
 
<table width="100%" border="0" rules="none" frame="void"
 
<table width="100%" border="0" rules="none" frame="void"
Line 589: Line 637:
  
 
<p style="margin-left:11%; margin-top: 1em">Copyright (C)
 
<p style="margin-left:11%; margin-top: 1em">Copyright (C)
2000-2008, Parallels, Inc. Licensed under GNU GPL.</p>
+
2000-2011, Parallels, Inc. Licensed under GNU GPL.</p>

Latest revision as of 16:04, 25 September 2012

NAME[edit]

vzquota − manipulate containers disk quotas

SYNOPSIS[edit]

vzquota [quota_options] command quota_id [command_options]

DESCRIPTION[edit]

vzquota controls disk quotas for Virtuozzo/OpenVZ container. These are per-container disk quotas set from Virtuozzo/OpenVZ host system.

The command can be one of the following: init, drop, on, off, setlimit, setlimit2, reload2, stat, show.

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[edit]

General[edit]

-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[edit]

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.

reload2

Reload second-level quota limits from quota file for given quota_id.

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.

Setting quota limits[edit]

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, on and setlimit 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.

Other options[edit]

−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/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[edit]

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[edit]

vzquota stat and vzquota show display the following information:
resource

Either 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.

In case option −t is specified, the following information is also displayed:
User/group quota:

Status of the 2nd level quota. This can be on or off, active or inactive. Values on/off define the state of the 2nd level quota at the next start of container quota. Values active/inactive indicate the current state of the 2nd level quota in the kernel.

Ugids:

Three values are shown: loaded, total and limit. loaded is the number of records (uids or gids) in the kernel. total is the number of unique records located in the kernel and quota file. limit is the current kernel limit of records amount. Note that loaded and total may be greater then limit.

Ugid limit was exceeded:

Can be yes or no. yes indicates that vzquota did not loaded all records into the kernel. In this case you should reduce the number of unique records (remove files which belong to unnecessary users) or increase the ugid limit. After that you should restart quota.

User/group grace times and quotafile flags:

Grace times and quota file flags (internal parameters of standard linux kernel quota v.3).

EXIT STATUS[edit]

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[edit]

Copyright (C) 2000-2011, Parallels, Inc. Licensed under GNU GPL.