Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

Man/vzquota.8

17,738 bytes added, 22:17, 3 June 2011
Automated import of articles
== NAME ==

<p style="margin-left:11%; margin-top: 1em">vzquota -
manipulate containers disk quotas</p>

== SYNOPSIS ==

<p style="margin-left:11%; margin-top: 1em"><b>vzquota</b>
[<i>quota_options</i>] <i>command quota_id</i>
[<i>command_options</i>]</p>

== DESCRIPTION ==

<p style="margin-left:11%; margin-top: 1em"><b>vzquota</b>
controls disk quotas for Virtuozzo/OpenVZ container. These
are per-container disk quotas set from Virtuozzo/OpenVZ host
system.</p>

<p style="margin-left:11%; margin-top: 1em">The
<b>quota_id</b> 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.</p>

== 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 ===

<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="3%">

<p><b>-h</b></p></td>
<td width="8%"></td>
<td width="78%">

<p>Print usage information.</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="3%">

<p><b>-V</b></p></td>
<td width="8%"></td>
<td width="78%">

<p>Print utility version.</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="3%">

<p><b>-q</b></p></td>
<td width="8%"></td>
<td width="78%">

<p>Quiet mode. Causes all warning and diagnostic messages
to be suppressed. Only fatal errors are displayed.</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="3%">

<p><b>-v</b></p></td>
<td width="8%"></td>
<td width="78%">

<p>Verbose mode. Causes <b>vzquota</b> to print debugging
messages about its progress. Multiple <b>-v</b> options
increase verbosity. Maximum is 2.</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="3%">

<p><b>-b</b></p></td>
<td width="8%"></td>
<td width="78%">

<p>Batch mode. in this mode outputs (usually on <b>stat</b>
and <b>show</b> commands) will be in format better suitable
for parsing by a script.</p></td></tr>
</table>

=== Quota Commands ===
available:</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="6%">

<p style="margin-top: 1em"><b>init</b></p></td>
<td width="5%"></td>
<td width="78%">

<p style="margin-top: 1em">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 <b>vzquota on</b> doesn&rsquo;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.</p></td></tr>
</table>

<p style="margin-left:22%; margin-top: 1em">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 <b>-c</b> and <b>-p</b> options
(see below). You can use also <b>-R</b> option instead of
<b>-c</b> 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).</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="6%">

<p style="margin-top: 1em"><b>drop</b></p></td>
<td width="5%"></td>
<td width="78%">

<p style="margin-top: 1em">Remove quota file. Command
checks if quota is running and refuses to remove file in
this case, option <b>-f</b> allows to override that
rule.</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="6%">

<p><b>on</b></p></td>
<td width="5%"></td>
<td width="78%">

<p>Turn quota on. If previous quota session wasn&rsquo;t
switched off properly (quota is not running, but quota file
indicates it is), initialization procedure will be
performed. <b>-f</b> option allow to force initialization
procedure regardless of the shutdown status. Command
<b>on</b> doesn&rsquo;t work in case specified quota id is
running.</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="6%">

<p><b>off</b></p></td>
<td width="5%"></td>
<td width="78%">

<p>Turn quota off, write usage statistic back to the quota
file. Doesn&rsquo;t work if quota file cannot be accessed,
also accepts <b>-f</b> 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 <b>-f</b> flag is
used.</p> </td></tr>
</table>

<p style="margin-left:11%;"><b>setlimit</b></p>

<p style="margin-left:22%;">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 <b>-f</b> specifies to mark quota as
dirty, so at the next quota start, disk will be rescanned
and usage updated.</p>

<p style="margin-left:11%;"><b>setlimit2</b></p>

<p style="margin-left:22%;">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.</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="6%">

<p><b>stat</b></p></td>
<td width="5%"></td>
<td width="78%">

<p>Show usage statistics and update it in quota file.
Option <b>-f</b> causes to do not read and update quota
file, just print statistics from kernel. Option <b>-t</b>
specifies to show and update user/group based quota
statistics for a container. Works on running containers
only. The command with <b>-t</b> option flushes all quota
statistics from kernel to file and thus may be used for
backup purposes.</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="6%">

<p><b>show</b></p></td>
<td width="5%"></td>
<td width="78%">

<p>Show usage and limits info from quota file. Option
<b>-t</b> specifies to show user/group quota information as
well.</p> </td></tr>
</table>

=== Quota Command Options ===
flags.</b> <br>
All these options are required in <b>init</b> command, and
optionally accepted in <b>on</b> and <b>setlimit</b>
commands.</p>

<p style="margin-left:11%;"><b>&minus;s</b>,
<b>--sub&minus;quotas 1</b><i>|</i><b>0</b></p>

<p style="margin-left:22%;">Enables or disables user/group
based quota inside the container. Here <b>1</b> means to
enable, and <b>0</b> - to disable. By default user/group
quota is disabled. This option is accepted by <b>init</b>
and <b>on</b> commands.</p>

<p style="margin-left:11%;"><b>&minus;u</b>
<i>user_id</i></p>

<p style="margin-left:22%;">For <b>setlimit2</b> command
only. Limits will be applied to the specified
<i>user_id</i>.</p>

<p style="margin-left:11%;"><b>&minus;g</b>
<i>group_id</i></p>

<p style="margin-left:22%;">For <b>setlimit2</b> command
only. Limits will be applied to the specified
<i>group_id</i>.</p>

<p style="margin-left:11%;"><b>&minus;u</b>,
<b>--ugid&minus;limit</b> <i>limit</i></p>

<p style="margin-left:22%;">For <b>on</b> and
<b>setlimit</b> commands only. Specifies maximum number of
user and group IDs allowed in the container. If the value is
<b>0</b>, user/group quota will not be accounted. Default
value is <i>0</i>. There is one note concerning
<b>setlimit</b> command. If first-level quota is running,
second-level quota is active and not all ugid objects were
loaded into kernel by <b>on</b> command due to insufficient
<i>ugid_limit</i> value (this can be checked by issuing
<b>stat -t</b> command and observing whether ugid limit was
exceeded), then <b>setlimit</b> with new <i>limit</i> value
updates it in kernel and file but this change does not take
immediate effect. Modification will be applied after quota
restart.</p>

<p style="margin-left:11%;"><b>&minus;b</b>,
<b>--block&minus;softlimit</b> <i>bsl</i></p>

<p style="margin-left:22%;">Disk quota block soft limit.
Soft limit is amount of blocks which excess is allowed in
time equal <i>exptime</i>. On the expiration of this time
soft limit becomes hard limit. Block limits are set in 1k
sized blocks.</p>

<p style="margin-left:11%;"><b>&minus;B</b>,
<b>--block&minus;hardlimit</b> <i>bhl</i></p>

<p style="margin-left:22%;">Disk quota block hard limit.
Hard limit is amount of blocks which excess is not
allowed.</p>

<p style="margin-left:11%;"><b>&minus;e</b>,
<b>--block&minus;exptime</b> <i>bet</i></p>

<p style="margin-left:22%;">Disk quota expiration time for
excess of a block soft limit. Time can be given in two
different formats: <br>
1. <i>dd:hh:mm:ss</i> <br>
For instance: <i>30</i> - 30 seconds; <i>12:00</i> - 12
minutes; <i>20:15:11:00</i> - 20 days, 15 hours, 11 minutes
<br>
2. <i>xxA</i>, where <i>A</i> - h/H(hour); d/D(day);
w/W(week); m/M(month); y/Y(year). <br>
For instance: <i>7D</i> - 7 days; <i>01w</i> - 1 week;
<i>3m</i> - 3 months</p>

<p style="margin-left:11%;"><b>&minus;i</b>,
<b>--inode&minus;softlimit</b> <i>isl</i></p>

<p style="margin-left:22%;">Disk quota inode soft limit.
Similarly to block soft limit.</p>

<p style="margin-left:11%;"><b>&minus;I</b>,
<b>--inode&minus;hardlimit</b> <i>ihl</i></p>

<p style="margin-left:22%;">Disk quota inode hard
limit.</p>

<p style="margin-left:11%;"><b>&minus;n</b>,
<b>--inode&minus;exptime</b> <i>iet</i></p>

<p style="margin-left:22%;">Disk quota expiration time for
excess of a inode soft limit.</p>

<p style="margin-left:11%;"><b>Quota options. <br>
&minus;p</b> <i>path</i></p>

<p style="margin-left:22%;">Point of quota accounting for
given <i>quota_id</i>. This option required for <b>init</b>
command and can be used also with any another command to
override quota path obtained from quota file. For <b>on</b>
and <b>setlimit</b> commands, this option can be used to set
and save new quota accounting path for given
<i>quota_id</i></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="3%">

<p><b>&minus;R</b></p></td>
<td width="8%"></td>
<td width="78%">

<p>Set special relative path to <i>quota_file</i>. If this
option is specified, quota file location will depends on
path to quota accounting dir: if your quota accounting path
is /path/to/<i>somewhere</i>/ than quota file will be
/path/to/quota.<i>somewhere</i>. If this option is not
specified, quota file location is
/var/vzquota/quota.<i>quota_id</i>. All commands accept this
option.</p> </td></tr>
</table>

<p style="margin-left:11%;"><b>&minus;c</b>
<i>quota_file</i></p>

<p style="margin-left:22%;">This option allows to specify a
<i>quota_file</i> to work with. All commands accept this
option. If this option is not specified, default file
location depends on whether <b>-R</b> option is specified or
not (see above).</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="3%">

<p><b>&minus;f</b></p></td>
<td width="8%"></td>
<td width="78%">

<p>Force option. Accepted by <b>drop</b>, <b>on</b>,
<b>off</b>, <b>stat</b>, <b>setlimit</b> and
<b>setlimit2</b> commands. Action of this option differs for
different commands and is described above for each command
separately.</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="3%">

<p><b>&minus;t</b></p></td>
<td width="8%"></td>
<td width="78%">

<p>For <b>stat</b> and <b>show</b> commands only. Processes
user/group quota statistics. Specifies whether to show
(update in file) user/group quota information.</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="3%">

<p><b>&minus;t</b></p></td>
<td width="8%"></td>
<td width="78%">

<p>For <b>setlimit2</b> command. Set second-level quota
time grace parameters.</p></td></tr>
</table>

== LIMITATIONS ==

<p style="margin-left:11%; margin-top: 1em">It is
impossible to start or stop quota accounting if the
directory given by <b>-p</b> option is busy. This is rather
limitation of kernel part of disk quota implementation.</p>

== DISPLAY ==

<p style="margin-left:11%; margin-top: 1em"><b>vzquota
stat</b> and <b>vzquota show</b> display the following
information:</p>

<p style="margin-left:11%; margin-top: 1em"><b>resource</b>
- 1k-blocks or inodes.</p>

<p style="margin-left:11%; margin-top: 1em"><b>usage</b> -
current usage of resource.</p>

<p style="margin-left:11%; margin-top: 1em"><b>softlimit</b>
- 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>
- resource limit. Current usage can&rsquo;t exceed this
limit.</p>

<p style="margin-left:11%; margin-top: 1em"><b>grace</b> -
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>

<p style="margin-left:11%; margin-top: 1em">If
<b>&minus;t</b> is specified the following information is
displayed also:</p>

<p style="margin-left:11%; margin-top: 1em"><b>User/group
quota</b> - 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.</p>

<p style="margin-left:11%; margin-top: 1em"><b>Ugids</b> -
<i>loaded</i>, <i>total</i> and <i>limit</i>. <i>loaded</i>
is number of records (uids or gids) in kernel. <i>total</i>
is number of unique records located in the kernel and quota
file. <i>limit</i> is current kernel limits of records
amount. <i>loaded</i> and <i>total</i> may be greater then
<i>limit</i>.</p>

<p style="margin-left:11%; margin-top: 1em"><b>Ugid limit
was exceeded</b> - yes or no. <i>Yes</i> 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 <i>limit</i>.
After that you should restart quota.</p>

<p style="margin-left:11%; margin-top: 1em"><b>User/group
grace times and quotafile flags</b> - during grace time
usage can exceed softlimit. Quotafile flags are internal
parameters of standard linux kernel quota v.3.</p>

== EXIT STATUS ==

<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="3%">

<p style="margin-top: 1em"><b>0</b></p></td>
<td width="8%"></td>
<td width="78%">

<p style="margin-top: 1em">Command executed
successfully</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="3%">

<p><b>1</b></p></td>
<td width="8%"></td>
<td width="78%">

<p>System error</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="3%">

<p><b>2</b></p></td>
<td width="8%"></td>
<td width="78%">

<p>Usage error</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="3%">

<p><b>3</b></p></td>
<td width="8%"></td>
<td width="78%">

<p>Virtuozzo syscall error</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="3%">

<p><b>4</b></p></td>
<td width="8%"></td>
<td width="78%">

<p>Quota file error</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="3%">

<p><b>5</b></p></td>
<td width="8%"></td>
<td width="78%">

<p>Quota is already running</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="3%">

<p><b>6</b></p></td>
<td width="8%"></td>
<td width="78%">

<p>Quota is not running</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="3%">

<p><b>7</b></p></td>
<td width="8%"></td>
<td width="78%">

<p>Can not get lock on this quota id</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="3%">

<p><b>8</b></p></td>
<td width="8%"></td>
<td width="78%">

<p>Directory tree crosses mount points</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="3%">

<p><b>9</b></p></td>
<td width="8%"></td>
<td width="78%">

<p>Quota is running but user/group quota is inactive; this
status is returned by <b>stat -t</b> command for information
purposes and does not indicate a error</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="3%">

<p><b>10</b></p></td>
<td width="8%"></td>
<td width="78%">

<p>Quota is marked as dirty in file; this status is
returned by <b>show</b> command for information purposes and
does not indicate a error</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="3%">

<p><b>11</b></p></td>
<td width="8%"></td>
<td width="78%">

<p>Quota file does not exist</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="3%">

<p><b>12</b></p></td>
<td width="8%"></td>
<td width="78%">

<p>Internal error</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="3%">

<p><b>13</b></p></td>
<td width="8%"></td>
<td width="78%">

<p>Can&rsquo;t obtain mount point</p></td></tr>
</table>

== COPYRIGHT ==

<p style="margin-left:11%; margin-top: 1em">Copyright (C)
2000-2008, Parallels, Inc. Licensed under GNU GPL.</p>
2,253
edits