Difference between revisions of "Man/vzctl.8"

From OpenVZ Virtuozzo Containers Wiki
< Man
Jump to: navigation, search
(beta version of man2wiki man page (work in progress!))
 
(Automated import of articles *** existing text overwritten ***)
 
(30 intermediate revisions by 4 users not shown)
Line 2: Line 2:
  
 
<p style="margin-left:11%; margin-top: 1em">vzctl &minus;
 
<p style="margin-left:11%; margin-top: 1em">vzctl &minus;
utility to control an OpenVZ container.</p>
+
perform various operations on an OpenVZ container</p>
  
 
== SYNOPSIS ==
 
== SYNOPSIS ==
  
<p style="margin-left:11%; margin-top: 1em">vzctl
+
<table width="100%" border="0" rules="none" frame="void"
[<i>flags</i>] <b>create</b> <i>CTID</i>
+
      cellspacing="0" cellpadding="0">
[<b>--ostemplate</b> <i>name</i>] [<b>--config</b>
+
<tr valign="top" align="left">
<i>name</i>] [<b>--private</b> <i>path</i>] [<b>--root</b>
+
<td width="11%"></td>
<i>path</i>] [<b>--ipadd</b> <i>addr</i>] [<b>--hostname</b>
+
<td width="7%">
<i>name</i>]</p>
 
  
<p style="margin-left:11%; margin-top: 1em">vzctl
+
<p style="margin-top: 1em"><b>vzctl</b></p></td>
[<i>flags</i>] <b>set</b> <i>CTID parameters</i>
+
<td width="2%"></td>
[<b>--save</b>]</p>
+
<td width="80%">
  
<p style="margin-left:11%; margin-top: 1em">vzctl
+
<p style="margin-top: 1em">[<i>flags</i>] <b>create</b>
[<i>flags</i>] <b>destroy</b> | <b>mount</b> | <b>umount</b>
+
<i>CTID --parameter value</i> [...]</p></td></tr>
| <b>start</b> | <b>stop</b> | <b>restart</b> |
+
<tr valign="top" align="left">
<b>status</b> | <b>quotaon</b> | <b>quotaoff</b> |
+
<td width="11%"></td>
<b>quotainit</b> <i>CTID</i></p>
+
<td width="7%">
  
<p style="margin-left:11%; margin-top: 1em">vzctl
+
<p><b>vzctl</b></p></td>
[<i>flags</i>] <b>exec</b> | <b>exec2</b> <i>CTID
+
<td width="2%"></td>
command</i> [<i>arg</i> ...]</p>
+
<td width="80%">
  
<p style="margin-left:11%; margin-top: 1em">vzctl
+
<p>[<i>flags</i>] <b>start</b> <i>CTID</i> [<b>--wait</b>]
[<i>flags</i>] <b>enter</b> <i>CTID</i> [<b>--exec</b>
+
[<b>--force</b>] [<b>--skip-fsck</b>]
<i>command</i> [<i>arg</i> ...]]</p>
+
[<b>--skip-remount</b>]</p> </td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="7%">
  
<p style="margin-left:11%; margin-top: 1em">vzctl
+
<p><b>vzctl</b></p></td>
[<i>flags</i>] <b>runscript</b> <i>CTID script</i></p>
+
<td width="2%"></td>
 +
<td width="80%">
  
<p style="margin-left:11%; margin-top: 1em">vzctl
+
<p>[<i>flags</i>] <b>stop</b> <i>CTID</i> [<b>--fast</b>]
<b>--help</b> | <b>--version</b></p>
+
[<b>--skip-umount</b>]</p> </td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="7%">
  
== DESCRIPTION ==
+
<p><b>vzctl</b></p></td>
 +
<td width="2%"></td>
 +
<td width="80%">
  
<p style="margin-left:11%; margin-top: 1em">Utility
+
<p>[<i>flags</i>] <b>restart</b> <i>CTID</i>
<b>vzctl</b> runs on the host system (otherwise known as
+
[<b>--wait</b>] [<b>--force</b>] [<b>--fast</b>]
Hardware Node, or HN) and performs direct manipulations with
+
[<b>--skip-fsck</b>] [<b>--skip-remount</b>]</p></td></tr>
containers (CTs).</p>
+
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="7%">
  
<p style="margin-left:11%; margin-top: 1em">Containers can
+
<p><b>vzctl</b></p></td>
be referred to by either numeric <i>CTID</i> or by name (see
+
<td width="2%"></td>
<b>--name</b> option). Note that CT ID &lt;= 100 are
+
<td width="80%">
reserved for OpenVZ internal purposes.</p>
 
  
== OPTIONS ==
+
<p>[<i>flags</i>] <b>suspend</b> | <b>resume</b>
 +
<i>CTID</i> [<b>--dumpfile&nbsp;</b><i>name</i>]</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="7%">
  
=== Flags ===
+
<p><b>vzctl</b></p></td>
 +
<td width="2%"></td>
 +
<td width="80%">
  
<p style="margin-top: 1em">These flags come before a
+
<p>[<i>flags</i>] <b>snapshot</b> <i>CTID</i>
command, and can be used with any command. They affect
+
[<b>--id&nbsp;</b><i>uuid</i>]
logging to console (terminal) only, and do not affect
+
[<b>--name&nbsp;</b><i>name</i>]
logging to a log file.</p>
+
[<b>--description&nbsp;</b><i>desc</i>]
 +
[<b>--skip-suspend</b>] [<b>--skip-config</b>]</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="7%">
  
<p style="margin-left:11%;"><b>--quiet</b></p>
+
<p><b>vzctl</b></p></td>
 +
<td width="2%"></td>
 +
<td width="80%">
  
<p style="margin-left:17%;">Disables output. Note that
+
<p>[<i>flags</i>] <b>snapshot-switch</b> <i>CTID</i>
scripts run by vzctl are still able to produce some
+
[<b>--skip-resume</b> | <b>--must-resume</b>]
output.</p>
+
[<b>--skip-config</b>] <b>--id</b> <i>uuid</i></p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="7%">
  
<p style="margin-left:11%;"><b>--verbose</b></p>
+
<p><b>vzctl</b></p></td>
 +
<td width="2%"></td>
 +
<td width="80%">
  
<p style="margin-left:17%;">Increments logging level up
+
<p>[<i>flags</i>] <b>snapshot-delete</b> <i>CTID</i>
from the default. Can be used multiple times. Default value
+
<b>--id</b> <i>uuid</i></p></td></tr>
is set to the value of <b>VERBOSE</b> parameter in the
+
<tr valign="top" align="left">
global configuration file [[Man/vz.conf.5|<b>vz.conf</b>(5)]], or to <b>0</b>
+
<td width="11%"></td>
if not set by <b>VERBOSE</b> parameter.</p>
+
<td width="7%">
  
=== Setting container parameters ===
+
<p><b>vzctl</b></p></td>
 +
<td width="2%"></td>
 +
<td width="80%">
  
<p style="margin-left:11%;"><b>set</b> <i>CTID
+
<p>[<i>flags</i>] <b>snapshot-mount</b> <i>CTID</i>
parameters</i> [<b>--save</b>] [<b>--force</b>]</p>
+
<b>--id</b> <i>uuid</i> <b>--target</b> <i>dir</i></p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="7%">
  
<p style="margin-left:17%;">This command sets various
+
<p><b>vzctl</b></p></td>
container parameters. If a <b>--save</b> flag is given,
+
<td width="2%"></td>
parameters are saved in container configuration file
+
<td width="80%">
[[Man/ctid.conf.5|<b>ctid.conf</b>(5)]]. Use <b>--force</b> to save the
 
parameters even if the current kernel doesn&rsquo;t support
 
OpenVZ. If the container is currently running, <b>vzctl</b>
 
applies these parameters to the container.</p>
 
  
<p style="margin-left:17%; margin-top: 1em">The following
+
<p>[<i>flags</i>] <b>snapshot-umount</b> <i>CTID</i>
parameters can be used with <b>set</b> command.</p>
+
<b>--id</b> <i>uuid</i></p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="7%">
  
<p style="margin-left:11%;"><b>Miscellaneous <br>
+
<p><b>vzctl</b></p></td>
--onboot yes</b>|<b>no</b></p>
+
<td width="2%"></td>
 +
<td width="80%">
  
<p style="margin-left:17%;">Sets whether the container will
+
<p>[<i>flags</i>] <b>snapshot-list</b> <i>CTID</i>
be started during system boot. The container will not be
+
[<b>-H</b>] [<b>-o</b> <i>field</i>[,<i>field</i>...]
auto-started unless this parameter is set to <i>yes</i>.</p>
+
[<b>--id</b> <i>uuid</i>]</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="7%">
  
<p style="margin-left:11%;"><b>--bootorder</b>
+
<p><b>vzctl</b></p></td>
<i>number</i></p>
+
<td width="2%"></td>
 +
<td width="80%">
  
<p style="margin-left:17%;">Sets the boot order priority
+
<p>[<i>flags</i>] <b>set</b> <i>CTID --parameter value</i>
for this CT. The higher the <i>number</i> is, the earlier in
+
[...] [<b>--save</b>] [<b>--force</b>]
the boot process this container starts. By default this
+
[<b>--setmode&nbsp;restart</b>|<b>ignore</b>]</p> </td></tr>
parameter is unset, which is considered to be the lowest
+
<tr valign="top" align="left">
priority, so containers with unset <b>bootorder</b> will
+
<td width="11%"></td>
start last.</p>
+
<td width="7%">
  
<p style="margin-left:11%;"><b>--root</b> <i>path</i></p>
+
<p><b>vzctl</b></p></td>
 +
<td width="2%"></td>
 +
<td width="80%">
  
<p style="margin-left:17%;">Sets the path to root directory
+
<p>[<i>flags</i>] <b>set</b> <i>CTID</i>
for this container. This is essentially a mount point for
+
<b>--reset_ub</b></p> </td></tr>
container&rsquo;s root directory. Argument can contain
+
<tr valign="top" align="left">
literal string <b>$VEID</b>, which will be substituted with
+
<td width="11%"></td>
the numeric CT ID. Changing this parameter is not
+
<td width="7%">
recommended, better edit [[Man/vz.conf.5|<b>vz.conf</b>(5)]] global
 
configuration file.</p>
 
  
<p style="margin-left:11%;"><b>--userpasswd</b>
+
<p><b>vzctl</b></p></td>
<i>user</i>:<i>password</i></p>
+
<td width="2%"></td>
 +
<td width="80%">
  
<p style="margin-left:17%;">Sets password for the given
+
<p>[<i>flags</i>] <b>destroy</b> | <b>delete</b> |
user in a container, creating the user if it does not
+
<b>mount</b> | <b>umount</b> | <b>status</b> |
exists. Note that this option is not saved in configuration
+
<b>quotaon</b> | <b>quotaoff</b> | <b>quotainit</b>
file at all (so <b>--save</b> flag is useless), it is
+
<i>CTID</i></p> </td></tr>
applied to the container (by modifying its /etc/passwd and
+
<tr valign="top" align="left">
/etc/shadow files).</p>
+
<td width="11%"></td>
 +
<td width="7%">
  
<p style="margin-left:17%; margin-top: 1em">In case
+
<p><b>vzctl</b></p></td>
container root filesystem is not mounted, it is
+
<td width="2%"></td>
automatically mounted, then all the appropriate file changes
+
<td width="80%">
are applied, then it is unmounted.</p>
 
  
<p style="margin-left:17%; margin-top: 1em">Note that
+
<p>[<i>flags</i>] <b>console</b> <i>CTID</i>
container should be created before using this option.</p>
+
[<i>ttynum</i>]</p> </td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="7%">
  
<p style="margin-left:11%;"><b>--disabled</b>
+
<p><b>vzctl</b></p></td>
<i>yes</i>|<i>no</i></p>
+
<td width="2%"></td>
 +
<td width="80%">
  
<p style="margin-left:17%;">Disable container start. To
+
<p>[<i>flags</i>] <b>convert</b> <i>CTID</i>
force the start of a disabled container, use <b>vzctl start
+
[<b>--layout&nbsp;ploop</b>[<b>:</b>{<b>expanded</b>|<b>plain</b>|<b>raw</b>}]]</p> </td></tr>
--force</b>.</p>
+
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="7%">
  
<p style="margin-left:11%;"><b>--name</b> <i>name</i></p>
+
<p><b>vzctl</b></p></td>
 +
<td width="2%"></td>
 +
<td width="80%">
  
<p style="margin-left:17%;">Add a name for a container. The
+
<p>[<i>flags</i>] <b>compact</b> <i>CTID</i></p></td></tr>
<i>name</i> can later be used in subsequent calls to
+
<tr valign="top" align="left">
<b>vzctl</b> in place of <i>CTID</i>.</p>
+
<td width="11%"></td>
 +
<td width="7%">
  
<p style="margin-left:11%;"><b>--description</b>
+
<p><b>vzctl</b></p></td>
<i>string</i></p>
+
<td width="2%"></td>
 +
<td width="80%">
  
<p style="margin-left:17%;">Add a textual description for a
+
<p>[<i>flags</i>] <b>exec</b> | <b>exec2</b> <i>CTID
container.</p>
+
command</i> [<i>arg</i> ...]</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="7%">
  
<p style="margin-left:11%;"><b>--setmode
+
<p><b>vzctl</b></p></td>
restart</b>|<b>ignore</b></p>
+
<td width="2%"></td>
 +
<td width="80%">
  
<p style="margin-left:17%;">Whether to restart a container
+
<p>[<i>flags</i>] <b>enter</b> <i>CTID</i>
after applying parameters that require the container to be
+
[<b>--exec&nbsp;</b><i>command&nbsp;</i>[<i>arg&nbsp;</i>...]]</p> </td></tr>
restarted in order to take effect.</p>
+
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="7%">
  
<p style="margin-left:11%;"><b>Networking <br>
+
<p><b>vzctl</b></p></td>
--ipadd</b> <i>addr</i></p>
+
<td width="2%"></td>
 +
<td width="80%">
  
<p style="margin-left:17%;">Adds IP address to a given
+
<p>[<i>flags</i>] <b>runscript</b> <i>CTID script</i></p></td></tr>
container. Note that this option is incremental, so
+
<tr valign="top" align="left">
<i>addr</i> are added to already existing ones.</p>
+
<td width="11%"></td>
 +
<td width="7%">
  
<p style="margin-left:11%;"><b>--ipdel</b> <i>addr</i> |
+
<p><b>vzctl</b></p></td>
<b>all</b></p>
+
<td width="2%"></td>
 +
<td width="80%">
  
<p style="margin-left:17%;">Removes IP address <i>addr</i>
+
<p><b>--help</b> | <b>--version</b></p></td></tr>
from a container. If you want to remove all the addresses,
+
</table>
use <b>--ipdel all</b>.</p>
 
  
<p style="margin-left:11%;"><b>--hostname</b>
+
== DESCRIPTION ==
<i>name</i></p>
 
  
<p style="margin-left:17%;">Sets container hostname.
+
<p style="margin-left:11%; margin-top: 1em">Utility
<b>vzctl</b> writes it to the appropriate file inside a
+
<b>vzctl</b> runs on the host system (otherwise known as
container (distribution-dependent).</p>
+
Hardware Node, or HN) and performs direct manipulations with
 +
containers (CTs).</p>
  
<p style="margin-left:11%;"><b>--nameserver</b>
+
<p style="margin-left:11%; margin-top: 1em">Containers can
<i>addr</i></p>
+
be referred to by either numeric <i>CTID</i> or by name (see
 +
<b>--name</b> option). Note that CT ID &lt;= 100 are
 +
reserved for OpenVZ internal purposes. A numeric ID should
 +
not be more than <b>2147483644</b>.</p>
  
<p style="margin-left:17%;">Sets DNS server IP address for
+
== OPTIONS ==
a container. If you want to set several nameservers, you
 
should do it at once, so use <b>--nameserver</b> option
 
multiple times in one call to <b>vzctl</b>, as all the name
 
server values set in previous calls to <b>vzctl</b> are
 
overwritten.</p>
 
  
<p style="margin-left:11%;"><b>--searchdomain</b>
+
=== Flags ===
<i>name</i></p>
 
  
<p style="margin-left:17%;">Sets DNS search domains for a
+
<p style="margin-top: 1em">These flags come before a
container. If you want to set several search domains, you
+
command, and can be used with any command. They affect
should do it at once, so use <b>--searchdomain</b> option
+
logging to console (terminal) only, and do not affect
multiple times in one call to <b>vzctl</b>, as all the
+
logging to a log file.</p>
search domain values set in previous calls to <b>vzctl</b>
 
are overwritten.</p>
 
  
<p style="margin-left:11%;"><b>--netif_add</b>
+
<p style="margin-left:11%;"><b>--quiet</b></p>
<i>ifname[</i>,<i>mac</i>,<i>host_ifname</i>,<i>host_mac</i>,<i>bridge]</i></p>
 
  
<p style="margin-left:17%;">Adds a virtual Ethernet device
+
<p style="margin-left:17%;">Disables output. Note that
(veth) to a given container. Here <i>ifname</i> is the
+
scripts run by vzctl are still able to produce some
Ethernet device name in the container, <i>mac</i> is its MAC
+
output.</p>
address, <i>host_ifname</i> is the Ethernet device name on
 
the host, and <i>host_mac</i> is its MAC address. MAC
 
addresses should be in the format like XX:XX:XX:XX:XX:XX.
 
<i>bridge</i> is an optional parameter which can be used in
 
custom network start scripts to automatically add the
 
interface to a bridge. All parameters except <i>ifname</i>
 
are optional and are automatically generated if not
 
specified.</p>
 
  
<p style="margin-left:11%;"><b>--netif_del</b>
+
<p style="margin-left:11%;"><b>--verbose</b></p>
<i>dev_name</i> | <b>all</b></p>
 
  
<p style="margin-left:17%;">Removes virtual Ethernet device
+
<p style="margin-left:17%;">Increments logging level up
from a container. If you want to remove all devices, use
+
from the default. Can be used multiple times. Default value
<b>all</b>.</p>
+
is set to the value of <b>VERBOSE</b> parameter in the
 +
global configuration file [[Man/vz.conf.5|<b>vz.conf</b>(5)]], or to <b>0</b>
 +
if not set by <b>VERBOSE</b> parameter.</p>
 +
 
 +
=== Setting container parameters ===
  
<p style="margin-left:11%;"><b>Veth interface
+
<table width="100%" border="0" rules="none" frame="void"
configuration</b></p>
+
      cellspacing="0" cellpadding="0">
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
  
<p style="margin-left:11%; margin-top: 1em">The following
+
<p style="margin-top: 1em"><b>set</b></p></td>
options can be used to reconfigure the already-created
+
<td width="2%"></td>
virtual Ethernet interface. To select the interface to
+
<td width="83%">
configure, use <b>--ifname</b> <i>name</i> option. <b><br>
 
--mac</b> <i>XX:XX:XX:XX:XX:XX</i></p>
 
  
<p style="margin-left:22%;">MAC address of interface inside
+
<p style="margin-top: 1em"><i>CTID</i>
a container.</p>
+
[<b>--onboot&nbsp;yes</b>|<b>no</b>]
 +
[<b>--bootorder&nbsp;</b><i>number</i>]
 +
[<b>--root&nbsp;</b><i>path</i>]
 +
[<b>--private&nbsp;</b><i>path</i>]
 +
[<b>--mount_opts&nbsp;</b><i>options</i>]
 +
[<b>--userpasswd&nbsp;</b><i>user</i>:<i>pass</i>]
 +
[<b>--disabled&nbsp;yes</b>|<b>no</b>]
 +
[<b>--name&nbsp;</b><i>name</i>]
 +
[<b>--description&nbsp;</b><i>string</i>]
 +
[<b>--ostemplate&nbsp;</b><i>string</i>]
 +
[<b>--stop-timeout&nbsp;</b><i>seconds</i>]
 +
[<b>--ipadd&nbsp;</b><i>addr</i>]
 +
[<b>--ipdel&nbsp;</b><i>addr</i>|<b>all</b>]
 +
[<b>--hostname&nbsp;</b><i>name</i>]
 +
[<b>--nameserver&nbsp;</b><i>addr</i>]
 +
[<b>--searchdomain&nbsp;</b><i>name</i>]
 +
[<b>--netif_add&nbsp;</b><i>dev</i>[,<i>params</i>...]]
 +
[<b>--netif_del&nbsp;</b><i>dev</i>|<b>all</b>]
 +
[<b>--ifname</b> <i>dev</i>
 +
[<b>--mac&nbsp;</b><i>hwaddr</i>]
 +
[<b>--host_ifname&nbsp;</b><i>dev</i>]
 +
[<b>--host_mac&nbsp;</b><i>hwaddr</i>]
 +
[<b>--bridge&nbsp;</b><i>name</i>]
 +
[<b>--mac_filter&nbsp;on</b>|<b>off</b>]]
 +
[<b>--numproc&nbsp;</b><i>items</i>]
 +
[<b>--numtcpsock&nbsp;</b><i>items</i>]
 +
[<b>--numothersock&nbsp;</b><i>items</i>]
 +
[<b>--vmguarpages&nbsp;</b><i>pages</i>]
 +
[<b>--kmemsize&nbsp;</b><i>bytes</i>]
 +
[<b>--tcpsndbuf&nbsp;</b><i>bytes</i>]
 +
[<b>--tcprcvbuf&nbsp;</b><i>bytes</i>]
 +
[<b>--othersockbuf&nbsp;</b><i>bytes</i>]
 +
[<b>--dgramrcvbuf&nbsp;</b><i>bytes</i>]
 +
[<b>--oomguarpages&nbsp;</b><i>pages</i>]
 +
[<b>--lockedpages&nbsp;</b><i>pages</i>]
 +
[<b>--privvmpages&nbsp;</b><i>pages</i>]
 +
[<b>--shmpages&nbsp;</b><i>pages</i>]
 +
[<b>--numfile&nbsp;</b><i>items</i>]
 +
[<b>--numflock&nbsp;</b><i>items</i>]
 +
[<b>--numpty&nbsp;</b><i>items</i>]
 +
[<b>--numsiginfo&nbsp;</b><i>items</i>]
 +
[<b>--dcachesize&nbsp;</b><i>bytes</i>]
 +
[<b>--numiptent&nbsp;</b><i>num</i>]
 +
[<b>--physpages&nbsp;</b><i>pages</i>]
 +
[<b>--swappages&nbsp;</b><i>pages</i>]
 +
[<b>--ram&nbsp;</b><i>bytes</i>]
 +
[<b>--swap&nbsp;</b><i>bytes</i>]
 +
[<b>--vm_overcommit&nbsp;</b><i>float</i>]
 +
[<b>--cpuunits&nbsp;</b><i>num</i>]
 +
[<b>--cpulimit&nbsp;</b><i>num</i>]
 +
[<b>--cpus&nbsp;</b><i>num</i>]
 +
[<b>--cpumask&nbsp;</b><i>cpus</i>|<b>auto</b>|<b>all</b>]
 +
[<b>--nodemask&nbsp;</b><i>nodes</i>|<b>all</b>]
 +
[<b>--meminfo&nbsp;none</b>|<i>mode</i>:<i>value</i>]
 +
[<b>--iptables&nbsp;</b><i>name</i>[<b>,</b>...]]
 +
[<b>--netfilter&nbsp;disabled</b>|<b>stateless</b>|<b>stateful</b>|<b>full</b>]
 +
[<b>--netdev_add&nbsp;</b><i>ifname</i>]
 +
[<b>--netdev_del&nbsp;</b><i>ifname</i>]
 +
[<b>--diskquota&nbsp;yes</b>|<b>no</b>]
 +
[<b>--diskspace&nbsp;</b><i>num</i>]
 +
[<b>--diskinodes&nbsp;</b><i>num</i>]
 +
[<b>--quotatime&nbsp;</b><i>seconds</i>]
 +
[<b>--quotaugidlimit&nbsp;</b><i>num</i>]
 +
[<b>--capability&nbsp;</b><i>capname</i>:<b>on</b>|<b>off</b>[<b>,</b>...]]
 +
[<b>--devnodes&nbsp;</b><i>param</i>]
 +
[<b>--devices&nbsp;</b><i>param</i>]
 +
[<b>--pci_add&nbsp;</b><i>dev</i>]
 +
[<b>--pci_del&nbsp;</b><i>dev</i>]
 +
[<b>--features&nbsp;</b><i>name</i>:<b>on</b>|<b>off</b>[<b>,</b>...]]
 +
[<b>--applyconfig&nbsp;</b><i>name</i>]
 +
[<b>--applyconfig_map&nbsp;</b><i>group</i>]
 +
[<b>--ioprio&nbsp;</b><i>num</i>]
 +
[<b>--iolimit&nbsp;</b><i>mbps</i>]
 +
[<b>--iopslimit&nbsp;</b><i>iops</i>] [<b>--save</b>]
 +
[<b>--force</b>] [<b>--reset_ub</b>]
 +
[<b>--setmode&nbsp;restart</b>|<b>ignore</b>]</p> </td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
</td>
 +
<td width="2%"></td>
 +
<td width="83%">
  
<p style="margin-left:11%;"><b>--host_ifname</b>
+
<p>This command sets various container parameters. If the
<i>name</i></p>
+
container is currently running, <b>vzctl</b> applies these
 +
parameters to the container. The following options can be
 +
used with <b>set</b> command.</p></td></tr>
 +
</table>
  
<p style="margin-left:22%;">interface name for virtual
+
==== Flags ====
interface in the host system.</p>
 
  
<p style="margin-left:11%;"><b>--host_mac</b>
+
<p style="margin-left:11%;"><b>--save</b></p>
<i>XX:XX:XX:XX:XX:XX</i></p>
 
  
<p style="margin-left:22%;">MAC address of interface in the
+
<p style="margin-left:17%;">If this flag is given,
host system.</p>
+
parameters are saved in container configuration file
 +
[[Man/ctid.conf.5|<b>ctid.conf</b>(5)]].</p>
  
<p style="margin-left:11%;"><b>--bridge</b> <i>name</i></p>
+
<p style="margin-left:11%;"><b>--force</b></p>
  
<p style="margin-left:22%;">Bridge name. Custom network
+
<p style="margin-left:17%;">If this flag is given together
start scripts can use this value to automatically add the
+
with <b>--save</b>, parameters are saved even if the current
interface to a bridge.</p>
+
kernel doesn&rsquo;t support OpenVZ. Note this flag does not
 +
make sense without <b>--save</b>, so <b>--save</b> is
 +
required.</p>
  
<p style="margin-left:11%;"><b>--mac_filter</b>
+
<p style="margin-left:11%;"><b>--reset_ub</b></p>
<i>on|off</i></p>
 
  
<p style="margin-left:22%;">Enables/disables MAC address
+
<p style="margin-left:17%;">If this flag is given,
filtering for the Container veth device and the possibility
+
<b>vzctl</b> applies all User Beancounter parameters from
of configuring the MAC address of this device from inside
+
the configuration file to a running container. This is
the Container. If the filtering is turned on: <br>
+
helpful in case configuration file is modified manually.
&bull; the veth device accepts only those packets that have
+
Please note this flag is exclusive, i.e. it can not be
a MAC address in their headers corresponding to that of this
+
combined with any other options or flags.</p>
device (excluding all broadcast and multicast packets); <br>
 
&bull; it is impossible to modify the veth MAC address from
 
inside the Container.</p>
 
  
<p style="margin-left:22%; margin-top: 1em">By default,
+
<p style="margin-left:11%;"><b>--setmode restart</b> |
this functionality is enabled for all veth devices existing
+
<b>ignore</b></p>
inside the Container.</p>
 
  
<p style="margin-left:11%;"><b>Resource limits</b></p>
+
<p style="margin-left:17%;">A few parameters can only be
 +
applied by restarting the container. By default,
 +
<b>vzctl</b> prints a warning if such parameters are
 +
supplied and a container is running. Use <b>--setmode
 +
restart</b> together with <b>--save</b> flag to restart a
 +
container in such a case, or <b>--setmode ignore</b> to
 +
suppress the warning.</p>
  
<p style="margin-left:22%; margin-top: 1em">The following
+
==== Miscellaneous ====
options sets barrier and limit for various user
 
beancounters. Each option requires one or two arguments. In
 
case of one argument, <b>vzctl</b> sets barrier and limit to
 
the same value. In case of two colon-separated arguments,
 
the first is a barrier, and the second is a limit. Each
 
argument is either a number, a number with a suffix, or a
 
special value <b>unlimited</b>.</p>
 
  
<p style="margin-left:22%; margin-top: 1em">Arguments are
+
<p style="margin-left:11%;"><b>--onboot yes</b> |
in items, pages or bytes. Note that page size is
+
<b>no</b></p>
architecture-specific, it is 4096 bytes on IA32
 
platform.</p>
 
  
<p style="margin-left:22%; margin-top: 1em">You can also
+
<p style="margin-left:17%;">Sets whether the container will
specify different suffixes for <b>set</b> parameters (except
+
be started during system boot. The container will be started
for the parameters which names start with <b>num</b>). For
+
on boot by <b>vz</b> initscript if either this parameter is
example, <b>vzctl set</b> <i>CTID</i> <b>--privvmpages
+
set to <b>yes</b>, or the container was running just before
5M:6M</b> should set <b>privvmpages</b>&rsquo; barrier to 5
+
last reboot, and this parameter is not set to <b>no</b>.
megabytes and its limit to 6 megabytes.</p>
+
Default value is unset, meaning the container will be
 +
started if it was running before the last reboot.</p>
  
<p style="margin-left:22%; margin-top: 1em">Available
+
<p style="margin-left:11%;"><b>--bootorder</b>
suffixes are: <b><br>
+
<i>number</i></p>
g</b>, <b>G</b> -- gigabytes. <b><br>
 
m</b>, <b>M</b> -- megabytes. <b><br>
 
k</b>, <b>K</b> -- kilobytes. <b><br>
 
p</b>, <b>P</b> -- pages (page is 4096 bytes on x86
 
architecture, other architectures may differ).</p>
 
  
<p style="margin-left:22%; margin-top: 1em">You can also
+
<p style="margin-left:17%;">Sets the boot order priority
specify the literal word <b>unlimited</b> in place of a
+
for this CT. The higher the <i>number</i> is, the earlier in
number. In that case the corresponding value will be set to
+
the boot process this container starts. By default this
<b>LONG_MAX</b>, i. e. the maximum possible value.</p>
+
parameter is unset, which is considered to be the lowest
 +
priority, so containers with unset <b>bootorder</b> will
 +
start last.</p>
  
<p style="margin-left:11%;"><b>--numproc</b>
+
<p style="margin-left:11%;"><b>--root</b> <i>path</i></p>
<i>items</i>[:<i>items</i>]</p>
 
  
<p style="margin-left:22%;">Maximum number of processes and
+
<p style="margin-left:17%;">Sets the path to root directory
kernel-level threads. Setting the barrier and the limit to
+
(<b>VE_ROOT</b>) for this container. This is essentially a
different values does not make practical sense.</p>
+
mount point for container&rsquo;s root directory. Argument
 +
can contain literal string <b>$VEID</b>, which will be
 +
substituted with the numeric CT ID.</p>
  
<p style="margin-left:11%;"><b>--numtcpsock</b>
+
<p style="margin-left:11%;"><b>--private</b>
<i>items</i>[:<i>items</i>]</p>
+
<i>path</i></p>
  
<p style="margin-left:22%;">Maximum number of TCP sockets.
+
<p style="margin-left:17%;">Sets the path to private
This parameter limits the number of TCP connections and,
+
directory (<b>VE_PRIVATE</b>) for this container. This is a
thus, the number of clients the server application can
+
directory in which all the container&rsquo;s files are
handle in parallel. Setting the barrier and the limit to
+
stored. Argument can contain literal string <b>$VEID</b>,
different values does not make practical sense.</p>
+
which will be substituted with the numeric CT ID.</p>
  
<p style="margin-left:11%;"><b>--numothersock</b>
+
<p style="margin-left:11%;"><b>--mount_opts</b>
<i>items</i>[:<i>items</i>]</p>
+
<i>option</i>[<b>,</b><i>option</i>...]</p>
  
<p style="margin-left:22%;">Maximum number of non-TCP
+
<p style="margin-left:17%;">Sets additional mount options
sockets (local sockets, UDP and other types of sockets).
+
for container file system. Only applicable for <b>ploop</b>
Setting the barrier and the limit to different values does
+
layout, ignored otherwise.</p>
not make practical sense.</p>
 
  
<p style="margin-left:11%;"><b>--vmguarpages</b>
+
<p style="margin-left:11%;"><b>--userpasswd</b>
<i>pages</i>[:<i>pages</i>]</p>
+
<i>user</i>:<i>password</i></p>
 +
 
 +
<p style="margin-left:17%;">Sets password for the given
 +
user in a container, creating the user if it does not
 +
exists. Note that this option is not saved in configuration
 +
file at all (so <b>--save</b> flag is useless), it is
 +
applied directly to the container, by running
 +
distribution-specific programs inside the container. It is
 +
not recommended to combine this option with any other
 +
options.</p>
  
<p style="margin-left:22%;">Memory allocation guarantee.
+
<p style="margin-left:17%; margin-top: 1em">In case
This parameter controls how much memory is available to a
+
container was not running, it is automatically started then
container. The barrier is the amount of memory that
+
all the appropriate changes are applied, then it is
container&rsquo;s applications are guaranteed to be able to
+
stopped.</p>
allocate. The meaning of the limit is currently unspecified;
 
it should be set to <b>unlimited</b>.</p>
 
  
<p style="margin-left:11%;"><b>--kmemsize</b>
+
<p style="margin-left:17%; margin-top: 1em">Note that
<i>bytes</i>[:<i>bytes</i>]</p>
+
container should be created before using this option.</p>
  
<p style="margin-left:22%;">Maximum amount of kernel memory
+
<p style="margin-left:11%;"><b>--disabled yes</b> |
used. This parameter is related to <b>--numproc</b>. Each
+
<b>no</b></p>
process consumes certain amount of kernel memory - 16 KB at
 
least, 30-50 KB typically. Very large processes may consume
 
a bit more. It is important to have a certain safety gap
 
between the barrier and the limit of this parameter: equal
 
barrier and limit may lead to the situation where the kernel
 
will need to kill container&rsquo;s applications to keep the
 
<b>kmemsize</b> usage under the limit.</p>
 
  
<p style="margin-left:11%;"><b>--tcpsndbuf</b>
+
<p style="margin-left:17%;">Disable container start. To
<i>bytes</i>[:<i>bytes</i>]</p>
+
force the start of a disabled container, use <b>vzctl start
 +
--force</b>.</p>
  
<p style="margin-left:22%;">Maximum size of TCP send
+
<p style="margin-left:11%;"><b>--name</b> <i>name</i></p>
buffers. Barrier should be not less than 64 KB, and
 
difference between barrier and limit should be equal to or
 
more than value of <b>numtcpsock</b> multiplied by 2.5
 
KB.</p>
 
  
<p style="margin-left:11%;"><b>--tcprcvbuf</b>
+
<p style="margin-left:17%;">Add a name for a container. The
<i>bytes</i>[:<i>bytes</i>]</p>
+
<i>name</i> can later be used in subsequent calls to
 +
<b>vzctl</b> in place of <i>CTID</i>. Note this option can
 +
not be used without <b>--save</b>.</p>
  
<p style="margin-left:22%;">Maximum size of TCP receive
+
<p style="margin-left:11%;"><b>--description</b>
buffers. Barrier should be not less than 64 KB, and
+
<i>string</i></p>
difference between barrier and limit should be equal to or
 
more than value of <b>numtcpsock</b> multiplied by 2.5
 
KB.</p>
 
  
<p style="margin-left:11%;"><b>--othersockbuf</b>
+
<p style="margin-left:17%;">Add a textual description for a
<i>bytes</i>[:<i>bytes</i>]</p>
+
container.</p>
  
<p style="margin-left:22%;">Maximum size of other (non-TCP)
+
<p style="margin-left:11%;"><b>--ostemplate</b>
socket send buffers. If container&rsquo;s processes needs to
+
<i>string</i></p>
send very large datagrams, the barrier should be set
 
accordingly. Increased limit is necessary for high
 
performance of communications through local (UNIX-domain)
 
sockets.</p>
 
  
<p style="margin-left:11%;"><b>--dgramrcvbuf</b>
+
<p style="margin-left:17%;">Sets a new value of
<i>bytes</i>[:<i>bytes</i>]</p>
+
<b>OSTEMPLATE</b> parameter in container configuration file
 +
[[Man/ctid.conf.5|<b>ctid.conf</b>(5)]]. Requires <b>--save</b> flag. Useful
 +
after a change/upgrade of a distribution running inside
 +
container, as vzctl uses the value of OSTEMPLATE to run
 +
distribution-specific scripts.</p>
  
<p style="margin-left:22%;">Maximum size of other (non-TCP)
+
<p style="margin-left:11%;"><b>--stop-timeout</b>
socket receive buffers. If container&rsquo;s processes needs
+
<i>seconds</i></p>
to receive very large datagrams, the barrier should be set
 
accordingly. The difference between the barrier and the
 
limit is not needed.</p>
 
  
<p style="margin-left:11%;"><b>--oomguarpages</b>
+
<p style="margin-left:17%;">Sets a time to wait for
<i>pages</i>[:<i>pages</i>]</p>
+
container to stop on <b>vzctl stop</b> before forcibly
 +
killing it, in seconds. Note this option can not be used
 +
without <b>--save</b> flag.</p>
  
<p style="margin-left:22%;">Guarantees against OOM kill.
+
<p style="margin-left:17%; margin-top: 1em">Special value
Under this beancounter the kernel accounts the total amount
+
of <b>0</b> means to use compiled-in default.</p>
of memory and swap space used by the container&rsquo;s
 
processes. The barrier of this parameter is the
 
out-of-memory guarantee. If the <b>oomguarpages</b> usage is
 
below the barrier, processes of this container are
 
guaranteed not to be killed in out-of-memory situations. The
 
meaning of limit is currently unspecified; it should be set
 
to <b>unlimited</b>.</p>
 
  
<p style="margin-left:11%;"><b>--lockedpages</b>
+
==== Networking ====
<i>pages</i>[:<i>pages</i>]</p>
 
  
<p style="margin-left:22%;">Maximum number of pages
+
<p style="margin-left:11%;"><b>--ipadd</b> <i>addr</i></p>
acquired by <b>mlock</b>(2).</p>
 
  
<p style="margin-left:11%;"><b>--privvmpages</b>
+
<p style="margin-left:17%;">Adds an IP address <i>addr</i>
<i>pages</i>[:<i>pages</i>]</p>
+
to a given container. Address can optionally have a netmask
 +
specified in the CIDR notation (e.g. <b>10.1.2.3/25</b>).
 +
Note that this option is incremental, so <i>addr</i> are
 +
added to already existing ones.</p>
  
<p style="margin-left:22%;">Allows controlling the amount
+
<p style="margin-left:11%;"><b>--ipdel</b> <i>addr</i> |
of memory allocated by the applications. For shared (mapped
+
<b>all</b></p>
as <b>MAP_SHARED</b>) pages, each container really using a
 
memory page is charged for the fraction of the page
 
(depending on the number of others using it). For
 
&quot;potentially private&quot; pages (mapped as
 
<b>MAP_PRIVATE</b>), container is charged either for a
 
fraction of the size or for the full size if the allocated
 
address space. In the latter case, the physical pages
 
associated with the allocated address space may be in
 
memory, in swap or not physically allocated yet.</p>
 
  
<p style="margin-left:22%; margin-top: 1em">The barrier and
+
<p style="margin-left:17%;">Removes IP address <i>addr</i>
the limit of this parameter control the upper boundary of
+
from a container. If you want to remove all the addresses,
the total size of allocated memory. Note that this upper
+
use <b>--ipdel all</b>.</p>
boundary does not guarantee that container will be able to
 
allocate that much memory. The primary mechanism to control
 
memory allocation is the <b>--vmguarpages</b> guarantee.</p>
 
  
<p style="margin-left:11%;"><b>--shmpages</b>
+
<p style="margin-left:11%;"><b>--hostname</b>
<i>pages</i>[:<i>pages</i>]</p>
+
<i>name</i></p>
  
<p style="margin-left:22%;">Maximum IPC SHM segment size.
+
<p style="margin-left:17%;">Sets container hostname.
Setting the barrier and the limit to different values does
+
<b>vzctl</b> writes it to the appropriate file inside a
not make practical sense.</p>
+
container (distribution-dependent).</p>
  
<p style="margin-left:11%;"><b>--numfile</b>
+
<p style="margin-left:11%;"><b>--nameserver</b>
<i>items</i>[:<i>items</i>]</p>
+
<i>addr</i></p>
  
<p style="margin-left:22%;">Maximum number of open files.
+
<p style="margin-left:17%;">Sets DNS server IP address for
In most cases the barrier and the limit should be set to the
+
a container. If you want to set several nameservers, you
same value. Setting the barrier to <b>0</b> effectively
+
should do it at once, so use <b>--nameserver</b> option
disables pre-charging optimization for this beancounter in
+
multiple times in one call to <b>vzctl</b>, as all the name
the kernel, which leads to the held value being precise but
+
server values set in previous calls to <b>vzctl</b> are
could slightly degrade file open performance.</p>
+
overwritten.</p>
  
<p style="margin-left:11%;"><b>--numflock</b>
+
<p style="margin-left:17%; margin-top: 1em">A special value
<i>items</i>[:<i>items</i>]</p>
+
of <b>inherit</b> can be used to auto-propagate nameserver
 +
value(s) from the host system&rsquo;s
 +
<b>/etc/resolv.conf</b> file.</p>
  
<p style="margin-left:22%;">Maximum number of file locks.
+
<p style="margin-left:11%;"><b>--searchdomain</b>
Safety gap should be between barrier and limit.</p>
+
<i>name</i></p>
  
<p style="margin-left:11%;"><b>--numpty</b>
+
<p style="margin-left:17%;">Sets DNS search domains for a
<i>items</i>[:<i>items</i>]</p>
+
container. If you want to set several search domains, you
 +
should do it at once, so use <b>--searchdomain</b> option
 +
multiple times in one call to <b>vzctl</b>, as all the
 +
search domain values set in previous calls to <b>vzctl</b>
 +
are overwritten.</p>
  
<p style="margin-left:22%;">Number of pseudo-terminals
+
<p style="margin-left:17%; margin-top: 1em">A special value
(PTY). Note that in OpenVZ each container can have not more
+
of <b>inherit</b> can be used to auto-propagate search
than 255 PTYs. Setting the barrier and the limit to
+
domain value(s) from the host system&rsquo;s
different values does not make practical sense.</p>
+
<b>/etc/resolv.conf</b> file.</p>
  
<p style="margin-left:11%;"><b>--numsiginfo</b>
+
<p style="margin-left:11%;"><b>--netif_add</b>
<i>items</i>[:<i>items</i>]</p>
+
<i>ifname[</i>,<i>mac</i>,<i>host_ifname</i>,<i>host_mac</i>,<i>bridge]</i></p>
  
<p style="margin-left:22%;">Number of siginfo structures.
+
<p style="margin-left:17%;">Adds a virtual Ethernet device
Setting the barrier and the limit to different values does
+
(veth) to a given container. Here <i>ifname</i> is the
not make practical sense.</p>
+
Ethernet device name in the container, <i>mac</i> is its MAC
 
+
address, <i>host_ifname</i> is the Ethernet device name on
<p style="margin-left:11%;"><b>--dcachesize</b>
+
the host, and <i>host_mac</i> is its MAC address. MAC
<i>bytes</i>[:<i>bytes</i>]</p>
+
addresses should be in the format like XX:XX:XX:XX:XX:XX.
 +
<i>bridge</i> is an optional parameter which can be used in
 +
custom network start scripts to automatically add the
 +
interface to a bridge. All parameters except <i>ifname</i>
 +
are optional and are automatically generated if not
 +
specified.</p>
  
<p style="margin-left:22%;">Maximum size of
+
<p style="margin-left:11%;"><b>--netif_del</b>
filesystem-related caches, such as directory entry and inode
+
<i>dev_name</i> | <b>all</b></p>
caches. Exists as a separate parameter to impose a limit
 
causing file operations to sense memory shortage and return
 
an errno to applications, protecting from memory shortages
 
during critical operations that should not fail. Safety gap
 
should be between barrier and limit.</p>
 
  
<p style="margin-left:11%;"><b>--numiptent</b>
+
<p style="margin-left:17%;">Removes virtual Ethernet device
<i>num</i>[:<i>num</i>]</p>
+
from a container. If you want to remove all devices, use
 
+
<b>all</b>.</p>
<p style="margin-left:22%;">Number of iptables (netfilter)
 
entries. Setting the barrier and the limit to different
 
values does not make practical sense.</p>
 
  
<p style="margin-left:11%;"><b>--physpages</b>
+
==== veth interface configuration ====
<i>pages</i>[:<i>pages</i>]</p>
 
  
<p style="margin-left:22%;">This is currently an
+
<p style="margin-left:11%; margin-top: 1em">The following
accounting-only parameter. It shows the usage of RAM by this
+
options can be used to reconfigure the already-created
container. Barrier should be set to 0, and limit should be
+
virtual Ethernet interface. To select the interface to
set to <b>unlimited</b>.</p>
+
configure, use <b>--ifname</b> <i>name</i> option. <b><br>
 +
--mac</b> <i>XX:XX:XX:XX:XX:XX</i></p>
  
<p style="margin-left:11%;"><b>--swappages</b>
+
<p style="margin-left:22%;">MAC address of interface inside
<i>pages</i>[:<i>pages</i>]</p>
+
a container.</p>
  
<p style="margin-left:22%;">The limit, if set, is used to
+
<p style="margin-left:11%;"><b>--host_ifname</b>
show a total amount of swap space available inside the
+
<i>name</i></p>
container. The barrier of this parameter is currently
 
ignored. The default value is <b>unlimited</b>, meaning
 
total swap will be reported as 0.</p>
 
  
<p style="margin-left:22%; margin-top: 1em">Note that in
+
<p style="margin-left:22%;">interface name for virtual
order for the value to be shown as total swap space,
+
interface in the host system.</p>
<b>--meminfo</b> parameter should be set to value other than
 
<b>none</b>.</p>
 
  
<p style="margin-left:11%;"><b>CPU fair scheduler
+
<p style="margin-left:11%;"><b>--host_mac</b>
parameters</b></p>
+
<i>XX:XX:XX:XX:XX:XX</i></p>
  
<p style="margin-left:22%; margin-top: 1em">These
+
<p style="margin-left:22%;">MAC address of interface in the
parameters control CPU usage by container.</p>
+
host system.</p>
  
<p style="margin-left:11%;"><b>--cpuunits</b>
+
<p style="margin-left:22%; margin-top: 1em">If you want an
<i>num</i></p>
+
independent communication with the Container through the
 +
bridge, you should specify a multicast MAC address here
 +
(FE:FF:FF:FF:FF:FF).</p>
  
<p style="margin-left:22%;">CPU weight for a container.
+
<p style="margin-left:11%;"><b>--bridge</b> <i>name</i></p>
Argument is positive non-zero number, passed to and used in
 
the kernel fair scheduler. The larger the number is, the
 
more CPU time this container gets. Maximum value is 500000,
 
minimal is 8. Number is relative to weights of all the other
 
running containers. If <b>cpuunits</b> are not specified,
 
default value of 1000 is used.</p>
 
  
<p style="margin-left:22%; margin-top: 1em">You can set CPU
+
<p style="margin-left:22%;">Bridge name. Custom network
weight for CT0 (host system itself) as well (use <b>vzctl
+
start scripts can use this value to automatically add the
set 0 --cpuunits</b> <i>num</i>). Usually, OpenVZ initscript
+
interface to a bridge.</p>
(<b>/etc/init.d/vz</b>) takes care of setting this.</p>
+
 
 +
<p style="margin-left:11%;"><b>--mac_filter on</b> |
 +
<b>off</b></p>
  
<p style="margin-left:11%;"><b>--cpulimit</b>
+
<p style="margin-left:22%;">Enables/disables MAC address
<i>num</i>[<b>%</b>]</p>
+
filtering for the Container veth device and the possibility
 +
of configuring the MAC address of this device from inside
 +
the Container. If the filtering is turned on: <br>
 +
&bull; the veth device accepts only those packets that have
 +
a MAC address in their headers corresponding to that of this
 +
device (excluding all broadcast and multicast packets); <br>
 +
&bull; it is impossible to modify the veth MAC address from
 +
inside the Container.</p>
  
<p style="margin-left:22%;">Limit of CPU usage for the
+
<p style="margin-left:22%; margin-top: 1em">By default,
container, in per cent. Note if the computer has 2 CPUs, it
+
this functionality is enabled for all veth devices existing
has total of 200% CPU time. Default CPU limit is <b>0</b>
+
inside the Container.</p>
(no CPU limit).</p>
 
  
<p style="margin-left:11%;"><b>--cpus</b> <i>num</i></p>
+
==== VSwap limits ====
  
<p style="margin-left:22%;">sets number of CPUs available
+
<p style="margin-left:11%; margin-top: 1em">The following
in the container.</p>
+
options sets memory and swap limits for VSwap-enabled
 +
kernels (kernel version 042stab042 or greater).</p>
  
<p style="margin-left:11%;"><b>--cpumask</b> <i>cpus</i> |
+
<p style="margin-left:11%; margin-top: 1em">Argument is in
<b>all</b></p>
+
bytes, unless otherwise specified by an optional suffix.
 +
Available suffixes are:</p>
  
<p style="margin-left:22%;">sets list of allowed CPUs for
+
<p style="margin-left:11%; margin-top: 1em">&bull;
the container. Input format is a comma-separated list of
+
<b>T</b>, <b>t</b> - terabytes; <br>
decimal numbers and ranges. Consecutively set bits are shown
+
&bull; <b>G</b>, <b>g</b> - gigabytes; <br>
as two hyphen-separated decimal numbers, the smallest and
+
&bull; <b>M</b>, <b>m</b> - megabytes; <br>
largest bit numbers set in the range. For example, if you
+
&bull; <b>K</b>, <b>k</b> - kilobytes; <br>
want the container to execute on CPUs 0, 1, 2, 7, you should
+
&bull; <b>P</b>, <b>p</b> - memory pages (arch-specific,
pass <b>0-2,7</b>. Default value is <b>all</b> (the
+
usually 4KB); <br>
container can execute on any CPU).</p>
+
&bull; <b>B</b>, <b>b</b> - bytes (this is the default).
 +
<b><br>
 +
--ram</b> <i>bytes</i></p>
  
<p style="margin-left:11%;"><b>Memory output
+
<p style="margin-left:22%;">Sets physical memory (RAM)
parameters</b></p>
+
available to a container. Actually, the option is a shortcut
 +
for setting <b>--physpages</b> limit (the barrier is set to
 +
0).</p>
  
<p style="margin-left:22%; margin-top: 1em">This parameter
+
<p style="margin-left:11%;"><b>--swap</b> <i>bytes</i></p>
control output of /proc/meminfo inside a container.</p>
 
  
<p style="margin-left:11%;"><b>--meminfo none</b></p>
+
<p style="margin-left:22%;">Set swap space available to a
 +
container. Actually, the option is a shortcut for setting
 +
<b>--swappages</b> limit (the barrier is set to 0).</p>
  
<p style="margin-left:22%;">No /proc/meminfo virtualization
+
<p style="margin-left:11%;"><b>--vm_overcommit</b>
(the same as on host system).</p>
+
<i>float</i></p>
 +
 
 +
<p style="margin-left:22%;">Set VM overcommitment value to
 +
<i>float</i>. If set, it is used to calculate
 +
<b>privmmpages</b> parameter in case it is not set
 +
explicitly (see below). Default value is <b>0</b>, meaning
 +
unlimited privvmpages.</p>
 +
 
 +
<p style="margin-left:11%; margin-top: 1em"><b>vzctl</b>
 +
checks if running kernel is VSwap capable, and refuses to
 +
use these parameters otherwise. This behavior can be
 +
overriden by using <b>--force</b> flag before
 +
parameters.</p>
 +
 
 +
<p style="margin-left:11%; margin-top: 1em">In VSwap mode,
 +
all beancounters other than RAM and swap become optional.
 +
Note though that if some optional beancounters are not set,
 +
they are calculated and set by vzctl implicitly, using the
 +
following formulae:</p>
 +
 
 +
<p style="margin-left:11%; margin-top: 1em"><b>&bull;
 +
lockedpages.barrier = oomguarpages.barrier = ram</b></p>
  
<p style="margin-left:11%;"><b>--meminfo</b>
+
<p style="margin-left:11%; margin-top: 1em"><b>&bull;
<i>mode</i>:<i>value</i></p>
+
lockedpages.limit = oomguarpages.limit = unlimited</b></p>
  
<p style="margin-left:22%;">Configure total memory output
+
<p style="margin-left:11%; margin-top: 1em"><b>&bull;
in a container. Reported free memory is evaluated
+
vmguarpages.barrier = vmguarpages.limit = ram + swap</b></p>
accordingly to the mode being set. Reported swap is
 
evaluated according to the settings of <b>--swappages</b>
 
parameter.</p>
 
  
<p style="margin-left:22%; margin-top: 1em">You can use the
+
<p style="margin-left:11%; margin-top: 1em"><b>&bull;
following modes for <i>mode</i>: <br>
+
privvmpages.barrier = privvmpages.limit = (ram + swap) *
&bull; <b>pages</b>:<i>value</i> - sets total memory in
+
vm_overcommit</b></p>
pages; <br>
 
&bull; <b>privvmpages</b>:<i>value</i> - sets total memory
 
as <b>privvmpages</b> * <i>value</i>.</p>
 
  
<p style="margin-left:22%; margin-top: 1em">Default is
+
<p style="margin-left:11%; margin-top: 1em">(if
<b>privvmpages:1</b>.</p>
+
<b>vm_overcommit</b> is <b>0</b> or not set,
 +
<b>privvmpages</b> is set to &quot;unlimited&quot;)</p>
  
<p style="margin-left:11%;"><b>Iptables control parameters
+
<p style="margin-left:11%; margin-top: 1em">Here is an
<br>
+
example of setting container 777 to have 512 megabytes of
--iptables</b> <i>name</i></p>
+
RAM and 1 gigabyte of swap:</p>
  
<p style="margin-left:22%;">Allow to use the functionality
+
<pre style="margin-left:11%;">   vzctl set 777 --ram 512M --swap 1G --save</pre>
of <i>name</i> iptables module inside the container. To
 
specify multiple <i>name</i>s, repeat --iptables for each,
 
or use space-separated list as an argument (enclosed in
 
single or double quotes to protect spaces).</p>
 
  
<p style="margin-left:22%; margin-top: 1em">The default
+
==== User Beancounter limits ====
list of enabled iptables modules is specified by the
 
<b>IPTABLES</b> variable in [[Man/vz.conf.5|<b>vz.conf</b>(5)]].</p>
 
  
<p style="margin-left:22%; margin-top: 1em">You can use the
+
<p style="margin-left:11%; margin-top: 1em">The following
following values for <i>name</i>: <b>iptable_filter</b>,
+
options sets barrier and limit for various user
<b>iptable_mangle</b>, <b>ipt_limit</b>,
+
beancounters.</p>
<b>ipt_multiport</b>, <b>ipt_tos</b>, <b>ipt_TOS</b>,
 
<b>ipt_REJECT</b>, <b>ipt_TCPMSS</b>, <b>ipt_tcpmss</b>,
 
<b>ipt_ttl</b>, <b>ipt_LOG</b>, <b>ipt_length</b>,
 
<b>ip_conntrack</b>, <b>ip_conntrack_ftp</b>,
 
<b>ip_conntrack_irc</b>, <b>ipt_conntrack</b>,
 
<b>ipt_state</b>, <b>ipt_helper</b>, <b>iptable_nat</b>,
 
<b>ip_nat_ftp</b>, <b>ip_nat_irc</b>, <b>ipt_REDIRECT</b>,
 
<b>xt_mac</b>, <b>ipt_recent</b>, <b>ipt_owner</b>.</p>
 
  
<p style="margin-left:11%;"><b>Network devices control
+
<p style="margin-left:11%; margin-top: 1em">Note that for
parameters <br>
+
VSwap-enabled kernels (version 042stab042 or greater) these
--netdev_add</b> <i>name</i></p>
+
limits are optional, you must only set <b>--ram</b> and
 +
<b>--swap</b> (see above). For older kernels, these limits
 +
are obligatory.</p>
  
<p style="margin-left:22%;">move network device from the
+
<p style="margin-left:11%; margin-top: 1em">Each option
host system to a specified container</p>
+
requires one or two arguments. In case of one argument,
 +
<b>vzctl</b> sets barrier and limit to the same value. In
 +
case of two colon-separated arguments, the first is a
 +
barrier, and the second is a limit. Each argument is either
 +
a number, a number with a suffix, or a special value
 +
<b>unlimited</b>.</p>
  
<p style="margin-left:11%;"><b>--netdev_del</b>
+
<p style="margin-left:11%; margin-top: 1em">Arguments are
<i>name</i></p>
+
in items, pages or bytes. Note that page size is
 +
architecture-specific, it is 4096 bytes on x86 and x86_64
 +
platforms.</p>
  
<p style="margin-left:22%;">delete network device from a
+
<p style="margin-left:11%; margin-top: 1em">You can also
specified container</p>
+
specify different suffixes for User Beancounter parameters
 +
(except for those which names start with <b>num</b>). For
 +
example, <b>vzctl set</b> <i>CTID</i> <b>--privvmpages
 +
5M:6M</b> should set <b>privvmpages</b>&rsquo; barrier to 5
 +
megabytes and its limit to 6 megabytes.</p>
  
<p style="margin-left:11%;"><b>Disk quota parameters <br>
+
<p style="margin-left:11%; margin-top: 1em">Available
--diskquota yes</b>|<b>no</b></p>
+
suffixes are:</p>
  
<p style="margin-left:22%;">allows to enable or disable
+
<p style="margin-left:11%; margin-top: 1em">&bull;
disk quota for a container. By default, a global value
+
<b>T</b>, <b>t</b> - terabytes; <br>
(<b>DISK_QUOTA</b>) from [[Man/vz.conf.5|<b>vz.conf</b>(5)]] is used.</p>
+
&bull; <b>G</b>, <b>g</b> - gigabytes; <br>
 +
&bull; <b>M</b>, <b>m</b> - megabytes; <br>
 +
&bull; <b>K</b>, <b>k</b> - kilobytes; <br>
 +
&bull; <b>P</b>, <b>p</b> - memory pages (arch-specific,
 +
usually 4KB); <br>
 +
&bull; <b>B</b>, <b>b</b> - bytes.</p>
  
<p style="margin-left:11%;"><b>--diskspace</b>
+
<p style="margin-left:11%; margin-top: 1em">You can also
<i>num</i>[:<i>num</i>]</p>
+
specify the literal word <b>unlimited</b> in place of a
 +
number. In that case the corresponding value will be set to
 +
<b>LONG_MAX</b>, i. e. the maximum possible value. <b><br>
 +
--numproc</b> <i>items</i>[:<i>items</i>]</p>
  
<p style="margin-left:22%;">sets soft and hard disk quota
+
<p style="margin-left:22%;">Maximum number of processes and
limits, in blocks. First parameter is soft limit, second is
+
kernel-level threads. Setting the barrier and the limit to
hard limit. One block is currently equal to 1Kb. Suffixes
+
different values does not make practical sense.</p>
<b>G</b>, <b>M</b>, <b>K</b> can also be specified (see
 
<b>Resource limits</b> section for more info on
 
suffixes).</p>
 
  
<p style="margin-left:11%;"><b>--diskinodes</b>
+
<p style="margin-left:11%;"><b>--numtcpsock</b>
<i>num</i>[:<i>num</i>]</p>
+
<i>items</i>[:<i>items</i>]</p>
  
<p style="margin-left:22%;">sets soft and hard disk quota
+
<p style="margin-left:22%;">Maximum number of TCP sockets.
limits, in i-nodes. First parameter is soft limit, second is
+
This parameter limits the number of TCP connections and,
hard limit.</p>
+
thus, the number of clients the server application can
 +
handle in parallel. Setting the barrier and the limit to
 +
different values does not make practical sense.</p>
  
<p style="margin-left:11%;"><b>--quotatime</b>
+
<p style="margin-left:11%;"><b>--numothersock</b>
<i>seconds</i></p>
+
<i>items</i>[:<i>items</i>]</p>
  
<p style="margin-left:22%;">sets quota grace period.
+
<p style="margin-left:22%;">Maximum number of non-TCP
Container is permitted to exceed its soft limits for the
+
sockets (local sockets, UDP and other types of sockets).
grace period, but once it has expired, the soft limit is
+
Setting the barrier and the limit to different values does
enforced as a hard limit.</p>
+
not make practical sense.</p>
  
<p style="margin-left:11%;"><b>--quotaugidlimit</b>
+
<p style="margin-left:11%;"><b>--vmguarpages</b>
<i>num</i></p>
+
<i>pages</i>[:<i>pages</i>]</p>
  
<p style="margin-left:22%;">sets maximum number of
+
<p style="margin-left:22%;">Memory allocation guarantee.
user/group IDs in a container for which disk quota inside
+
This parameter controls how much memory is available to a
the container will be accounted. If this value is set to
+
container. The barrier is the amount of memory that
<b>0</b>, user and group quotas inside the container will
+
container&rsquo;s applications are guaranteed to be able to
not be accounted.</p>
+
allocate. The meaning of the limit is currently unspecified;
 +
it should be set to <b>unlimited</b>.</p>
  
<p style="margin-left:22%; margin-top: 1em">Note that if
+
<p style="margin-left:11%;"><b>--kmemsize</b>
you have previously set value of this parameter to <b>0</b>,
+
<i>bytes</i>[:<i>bytes</i>]</p>
changing it while the container is running will not take
 
effect.</p>
 
  
<p style="margin-left:11%;"><b>Mount option <br>
+
<p style="margin-left:22%;">Maximum amount of kernel memory
--noatime yes</b> | <b>no</b></p>
+
used. This parameter is related to <b>--numproc</b>. Each
 +
process consumes certain amount of kernel memory - 16 KB at
 +
least, 30-50 KB typically. Very large processes may consume
 +
a bit more. It is important to have a certain safety gap
 +
between the barrier and the limit of this parameter: equal
 +
barrier and limit may lead to the situation where the kernel
 +
will need to kill container&rsquo;s applications to keep the
 +
<b>kmemsize</b> usage under the limit.</p>
  
<p style="margin-left:22%;">Sets noatime flag (do not
+
<p style="margin-left:11%;"><b>--tcpsndbuf</b>
update inode access times) on filesystem.</p>
+
<i>bytes</i>[:<i>bytes</i>]</p>
  
<p style="margin-left:11%;"><b>Capability option <br>
+
<p style="margin-left:22%;">Maximum size of TCP send
--capability</b> <i>capname</i>:<b>on</b>|<b>off</b></p>
+
buffers. Barrier should be not less than 64 KB, and
 
+
difference between barrier and limit should be equal to or
<p style="margin-left:22%;">Sets a capability for a
+
more than value of <b>numtcpsock</b> multiplied by 2.5
container. Note that setting capability when the container
+
KB.</p>
is running does not take immediate effect; restart the
 
container in order for the changes to take effect. Note a
 
container has default set of capabilities, thus any
 
operation on capabilities is &quot;logical and&quot; with
 
the default capability mask.</p>
 
  
<p style="margin-left:22%; margin-top: 1em">You can use the
+
<p style="margin-left:11%;"><b>--tcprcvbuf</b>
following values for <i>capname</i>: <b>chown</b>,
+
<i>bytes</i>[:<i>bytes</i>]</p>
<b>dac_override</b>, <b>dac_read_search</b>, <b>fowner</b>,
 
<b>fsetid</b>, <b>kill</b>, <b>setgid</b>, <b>setuid</b>,
 
<b>setpcap</b>, <b>linux_immutable</b>,
 
<b>net_bind_service</b>, <b>net_broadcast</b>,
 
<b>net_admin</b>, <b>net_raw</b>, <b>ipc_lock</b>,
 
<b>ipc_owner</b>, <b>sys_module</b>, <b>sys_rawio</b>,
 
<b>sys_chroot</b>, <b>sys_ptrace</b>, <b>sys_pacct</b>,
 
<b>sys_admin</b>, <b>sys_boot</b>, <b>sys_nice</b>,
 
<b>sys_resource</b>, <b>sys_time</b>, <b>sys_tty_config</b>,
 
<b>mknod</b>, <b>lease</b>, <b>setveid</b>, <b>ve_admin</b>.
 
For detailed description, see <b>capabilities</b>(7).</p>
 
  
<p style="margin-left:22%; margin-top: 1em"><b>WARNING</b>:
+
<p style="margin-left:22%;">Maximum size of TCP receive
setting some of those capabilities may have far reaching
+
buffers. Barrier should be not less than 64 KB, and
security implications, so do not do it unless you know what
+
difference between barrier and limit should be equal to or
you are doing. Also note that setting <b>setpcap:on</b> for
+
more than value of <b>numtcpsock</b> multiplied by 2.5
a container will most probably lead to inability to start
+
KB.</p>
it.</p>
 
  
<p style="margin-left:11%;"><b>Device access management
+
<p style="margin-left:11%;"><b>--othersockbuf</b>
<br>
+
<i>bytes</i>[:<i>bytes</i>]</p>
--devnodes</b> <i>device</i>:<b>[r][w][q]|none</b></p>
 
  
<p style="margin-left:22%;">Give the container an access
+
<p style="margin-left:22%;">Maximum size of other (non-TCP)
(<b>r</b> - read, <b>w</b> - write, <b>q</b> - disk quota
+
socket send buffers. If container&rsquo;s processes needs to
management, <b>none</b> - no access) to a device designated
+
send very large datagrams, the barrier should be set
by the special file /dev/<i>device</i>. Device file is
+
accordingly. Increased limit is necessary for high
created in a container by <b>vzctl</b>. Example: <b>vzctl
+
performance of communications through local (UNIX-domain)
set 777 --devnodes sdb:rwq</b>.</p>
+
sockets.</p>
  
<p style="margin-left:11%;"><b>--devices
+
<p style="margin-left:11%;"><b>--dgramrcvbuf</b>
b|c</b>:<i>major</i>:<i>minor</i>|<b>all</b>:<b>[r][w][q]|none</b></p>
+
<i>bytes</i>[:<i>bytes</i>]</p>
  
<p style="margin-left:22%;">Give the container an access to
+
<p style="margin-left:22%;">Maximum size of other (non-TCP)
a <b>b</b>lock or <b>c</b>haracter device designated by its
+
socket receive buffers. If container&rsquo;s processes needs
<i>major</i> and <i>minor</i> numbers. Device file have to
+
to receive very large datagrams, the barrier should be set
be created manually.</p>
+
accordingly. The difference between the barrier and the
 +
limit is not needed.</p>
  
<p style="margin-left:11%;"><b>PCI device management <br>
+
<p style="margin-left:11%;"><b>--oomguarpages</b>
--pci_add</b>
+
<i>pages</i>[:<i>pages</i>]</p>
[<i>domain</i><b>:</b>]<i>bus</i><b>:</b><i>slot</i><b>.</b><i>func</i></p>
 
  
<p style="margin-left:22%;">Give the container an access to
+
<p style="margin-left:22%;">Guarantees against OOM kill.
a specified PCI device. All numbers are hexadecimal (as
+
Under this beancounter the kernel accounts the total amount
printed by <b>lspci</b>(8) in the first column).</p>
+
of memory and swap space used by the container&rsquo;s
 +
processes. The barrier of this parameter is the
 +
out-of-memory guarantee. If the <b>oomguarpages</b> usage is
 +
below the barrier, processes of this container are
 +
guaranteed not to be killed in out-of-memory situations. The
 +
meaning of limit is currently unspecified; it should be set
 +
to <b>unlimited</b>.</p>
  
<p style="margin-left:11%;"><b>--pci_del</b>
+
<p style="margin-left:11%;"><b>--lockedpages</b>
[<i>domain</i><b>:</b>]<i>bus</i><b>:</b><i>slot</i><b>.</b><i>func</i></p>
+
<i>pages</i>[:<i>pages</i>]</p>
  
<p style="margin-left:22%;">Delete a PCI device from the
+
<p style="margin-left:22%;">Maximum number of pages
container.</p>
+
acquired by <b>mlock</b>(2).</p>
  
<p style="margin-left:22%; margin-top: 1em">Note that
+
<p style="margin-left:11%;"><b>--privvmpages</b>
<b>vps-pci</b> configuration script is executed by
+
<i>pages</i>[:<i>pages</i>]</p>
<b>vzctl</b> then configuring PCI devices. The script is
 
usually located at <b>/usr/lib[64]/vzctl/scripts/</b>.</p>
 
  
<p style="margin-left:11%;"><b>Features management <br>
+
<p style="margin-left:22%;">Allows controlling the amount
--features</b> <i>name</i><b>:on</b>|<b>off</b></p>
+
of memory allocated by the applications. For shared (mapped
 
+
as <b>MAP_SHARED</b>) pages, each container really using a
<p style="margin-left:22%;">Enable or disable a specific
+
memory page is charged for the fraction of the page
container feature. Known features are: <b>sysfs</b>,
+
(depending on the number of others using it). For
<b>nfs</b>, <b>sit</b>, <b>ipip</b>, <b>ppp</b>,
+
&quot;potentially private&quot; pages (mapped as
<b>ipgre</b>, <b>bridge</b>, <b>nfsd</b>.</p>
+
<b>MAP_PRIVATE</b>), container is charged either for a
 +
fraction of the size or for the full size if the allocated
 +
address space. In the latter case, the physical pages
 +
associated with the allocated address space may be in
 +
memory, in swap or not physically allocated yet.</p>
  
<p style="margin-left:11%;"><b>Apply config <br>
+
<p style="margin-left:22%; margin-top: 1em">The barrier and
--applyconfig</b> <i>name</i></p>
+
the limit of this parameter control the upper boundary of
 +
the total size of allocated memory. Note that this upper
 +
boundary does not guarantee that container will be able to
 +
allocate that much memory. The primary mechanism to control
 +
memory allocation is the <b>--vmguarpages</b> guarantee.</p>
  
<p style="margin-left:22%;">Read container parameters from
+
<p style="margin-left:11%;"><b>--shmpages</b>
the container sample configuration file
+
<i>pages</i>[:<i>pages</i>]</p>
<tt>/etc/vz/conf/ve-</tt><i>name</i><tt>.conf-sample</tt>,
 
and apply them, if <b>--save</b> option specified save to
 
the container config file. The following parameters are not
 
changed: <b>HOSTNAME</b>, <b>IP_ADDRESS</b>,
 
<b>OSTEMPLATE</b>, <b>VE_ROOT</b>, and
 
<b>VE_PRIVATE</b>.</p>
 
  
<p style="margin-left:11%;"><b>--applyconfig_map</b>
+
<p style="margin-left:22%;">Maximum IPC SHM segment size.
<i>group</i></p>
+
Setting the barrier and the limit to different values does
 +
not make practical sense.</p>
  
<p style="margin-left:22%;">Apply container config
+
<p style="margin-left:11%;"><b>--numfile</b>
parameters selected by <i>group</i>. Now the only possible
+
<i>items</i>[:<i>items</i>]</p>
value for <i>group</i> is <b>name</b>: to restore container
 
name based on <b>NAME</b> variable in container
 
configuration file.</p>
 
  
<p style="margin-left:11%;"><b>I/O priority management <br>
+
<p style="margin-left:22%;">Maximum number of open files.
--ioprio</b> <i>priority</i></p>
+
In most cases the barrier and the limit should be set to the
 +
same value. Setting the barrier to <b>0</b> effectively
 +
disables pre-charging optimization for this beancounter in
 +
the kernel, which leads to the held value being precise but
 +
could slightly degrade file open performance.</p>
  
<p style="margin-left:22%;">Assigns I/O priority to
+
<p style="margin-left:11%;"><b>--numflock</b>
container. <i>Priority</i> range is <b>0-7</b>. The greater
+
<i>items</i>[:<i>items</i>]</p>
<i>priority</i> is, the more time for I/O activity container
 
has. By default each container has <i>priority</i> of
 
<b>4</b>.</p>
 
  
=== Checkpointing and restore ===
+
<p style="margin-left:22%;">Maximum number of file locks.
 +
Safety gap should be between barrier and limit.</p>
  
<p style="margin-top: 1em">Checkpointing is a feature of
+
<p style="margin-left:11%;"><b>--numpty</b>
OpenVZ kernel which allows to save a complete state of a
+
<i>items</i>[:<i>items</i>]</p>
running container, and to restore it later.</p>
 
  
<p style="margin-left:11%;"><b>chkpnt</b> <i>CTID</i>
+
<p style="margin-left:22%;">Number of pseudo-terminals
[<b>--dumpfile</b> <i>name</i>]</p>
+
(PTY). Note that in OpenVZ each container can have not more
 +
than 255 PTYs. Setting the barrier and the limit to
 +
different values does not make practical sense.</p>
  
<p style="margin-left:17%;">This command saves a complete
+
<p style="margin-left:11%;"><b>--numsiginfo</b>
state of a running container to a dump file, and stops the
+
<i>items</i>[:<i>items</i>]</p>
container. If an option <b>--dumpfile</b> is not set,
 
default dump file name <b>/vz/dump/Dump.</b><i>CTID</i> is
 
used.</p>
 
  
<p style="margin-left:11%;"><b>restore</b> <i>CTID</i>
+
<p style="margin-left:22%;">Number of siginfo structures.
[<b>--dumpfile</b> <i>name</i>]</p>
+
Setting the barrier and the limit to different values does
 +
not make practical sense.</p>
  
<p style="margin-left:17%;">This command restores a
+
<p style="margin-left:11%;"><b>--dcachesize</b>
container from the dump file created by the <b>chkpnt</b>
+
<i>bytes</i>[:<i>bytes</i>]</p>
command.</p>
 
  
=== Performing container actions ===
+
<p style="margin-left:22%;">Maximum size of
 +
filesystem-related caches, such as directory entry and inode
 +
caches. Exists as a separate parameter to impose a limit
 +
causing file operations to sense memory shortage and return
 +
an errno to applications, protecting from memory shortages
 +
during critical operations that should not fail. Safety gap
 +
should be between barrier and limit.</p>
  
<p style="margin-left:11%;"><b>create</b> <i>CTID</i>
+
<p style="margin-left:11%;"><b>--numiptent</b>
[<b>--ostemplate</b> <i>name</i>] [<b>--config</b>
+
<i>num</i>[:<i>num</i>]</p>
<i>name</i>] [<b>--private</b> <i>path</i>] <br>
 
[<b>--root</b> <i>path</i>] [<b>--ipadd</b> <i>addr</i>]
 
[<b>--hostname</b> <i>name</i>]</p>
 
  
<p style="margin-left:17%;">Creates a new container area.
+
<p style="margin-left:22%;">Number of iptables (netfilter)
This operation should be done once, before the first start
+
entries. Setting the barrier and the limit to different
of the container.</p>
+
values does not make practical sense.</p>
  
<p style="margin-left:17%; margin-top: 1em">If the
+
<p style="margin-left:11%;"><b>--physpages</b>
<b>--config</b> option is specified, values from example
+
<i>pages</i>[:<i>pages</i>]</p>
configuration file
 
<b>/etc/vz/conf/ve-</b><i>name</i><b>.conf-sample</b> are
 
put into the container configuration file. If this container
 
configuration file already exists, it will be removed.</p>
 
  
<p style="margin-left:17%; margin-top: 1em">You can use
+
<p style="margin-left:22%;">On VSwap-enabled kernels, this
<b>--root</b> <i>path</i> option to sets the path to the
+
limits the amount of physical memory (RAM) available to a
mount point for the container root directory (default is
+
container. The barrier should be set to <b>0</b>, and the
<b>VE_ROOT</b> specified in [[Man/vz.conf.5|<b>vz.conf</b>(5)]] file).
+
limit to a total size of RAM that can be used used by a
Argument can contain literal string <b>$VEID</b>, which will
+
container.</p>
be substituted with the numeric CT ID.</p>
 
  
<p style="margin-left:17%; margin-top: 1em">You can use
+
<p style="margin-left:22%; margin-top: 1em">For older
<b>--private</b> <i>path</i> option to set the path to
+
kernels, this is an accounting-only parameter, showing the
directory in which all the files and directories specific to
+
usage of RAM by this container. Barrier should be set to
this very container are stored (default is <b>VE_PRIVATE</b>
+
<b>0</b>, and limit should be set to <b>unlimited</b>.</p>
specified in [[Man/vz.conf.5|<b>vz.conf</b>(5)]] file). Argument can contain
 
literal string <b>$VEID</b>, which will be substituted with
 
the numeric CT ID.</p>
 
  
<p style="margin-left:17%; margin-top: 1em">You can use
+
<p style="margin-left:11%;"><b>--swappages</b>
<b>--ipadd</b> <i>addr</i> option to assign an IP address to
+
<i>pages</i>[:<i>pages</i>]</p>
a container. Note that this option can be used multiple
 
times.</p>
 
  
<p style="margin-left:17%; margin-top: 1em">You can use
+
<p style="margin-left:22%;">For VSwap-enabled kernels
<b>--hostname</b> <i>name</i> option to set a host name for
+
(042stab042 or greater), this parameter limits the amount of
a container.</p>
+
swap space available to a container. The barrier should be
 +
set to <b>0</b>, and the limit to a total size of swap that
 +
can be used by a container.</p>
  
<p style="margin-left:11%;"><b>destroy</b> |
+
<p style="margin-left:22%; margin-top: 1em">For older
<b>delete</b></p>
+
(pre-VSwap) kernels, the limit is used to show a total
 +
amount of swap space available inside the container. The
 +
barrier of this parameter is ignored. The default value is
 +
<b>unlimited</b>, meaning total swap will be reported as
 +
0.</p>
  
<p style="margin-left:17%;">Removes a container private
+
==== CPU fair scheduler parameters ====
area by deleting all files, directories and the
 
configuration file of this container.</p>
 
  
<p style="margin-left:11%;"><b>start</b> [<b>--wait</b>]
+
<p style="margin-left:11%; margin-top: 1em">These
[<b>--force</b>]</p>
+
parameters control CPU usage by container. <b><br>
 +
--cpuunits</b> <i>num</i></p>
  
<p style="margin-left:17%;">Mounts (if necessary) and
+
<p style="margin-left:22%;">CPU weight for a container.
starts a container. Unless <b>--wait</b> option is
+
Argument is positive non-zero number, passed to and used in
specified, <b>vzctl</b> will return immediately; otherwise
+
the kernel fair scheduler. The larger the number is, the
an attempt to wait till the default runlevel is reached will
+
more CPU time this container gets. Maximum value is 500000,
be made by <b>vzctl</b>.</p>
+
minimal is 8. Number is relative to weights of all the other
 +
running containers. If <b>cpuunits</b> are not specified,
 +
default value of 1000 is used.</p>
  
<p style="margin-left:17%; margin-top: 1em">Specify
+
<p style="margin-left:22%; margin-top: 1em">You can set CPU
<b>--force</b> if you want to start a container which is
+
weight for CT0 (host system itself) as well (use <b>vzctl
disabled (see <b>--disabled</b>).</p>
+
set 0 --cpuunits</b> <i>num</i>). Usually, OpenVZ initscript
 +
(<b>/etc/init.d/vz</b>) takes care of setting this.</p>
  
<p style="margin-left:17%; margin-top: 1em">Note that this
+
<p style="margin-left:11%;"><b>--cpulimit</b>
command can lead to execution of <b>premount</b>,
+
<i>num</i>[<b>%</b>]</p>
<b>mount</b> and <b>start</b> action scripts (see <b>ACTION
 
SCRIPTS</b> below).</p>
 
  
<p style="margin-left:11%;"><b>stop</b> [<b>--fast</b>]</p>
+
<p style="margin-left:22%;">Limit of CPU usage for the
 +
container, in per cent. Note if the computer has 2 CPUs, it
 +
has total of 200% CPU time. Default CPU limit is <b>0</b>
 +
(no CPU limit).</p>
  
<p style="margin-left:17%;">Stops and unmounts a container.
+
<p style="margin-left:11%;"><b>--cpus</b> <i>num</i></p>
Normally, <b>halt</b>(8) is executed inside a container;
 
option <b>--fast</b> makes <b>vzctl</b> use <b>reboot</b>(2)
 
syscall instead which is faster but can lead to unclean
 
container shutdown.</p>
 
  
<p style="margin-left:17%; margin-top: 1em">Note that this
+
<p style="margin-left:22%;">sets number of CPUs available
command can lead to execution of <b>stop</b>, <b>umount</b>
+
in the container.</p>
and <b>postumount</b> action scripts (see <b>ACTION
 
SCRIPTS</b> below).</p>
 
  
<p style="margin-left:11%;"><b>restart</b></p>
+
<p style="margin-left:11%;"><b>--cpumask</b> <i>cpus</i> |
 +
<b>auto</b> | <b>all</b></p>
  
<p style="margin-left:17%;">Restarts a container, i.e.
+
<p style="margin-left:22%;">Sets list of allowed CPUs for
stops it if it is running, and starts again. Accepts all the
+
the container. Input format is a comma-separated list of
<b>start</b> and <b>stop</b> options.</p>
+
decimal numbers and/or ranges. Consecutively set bits are
 +
shown as two hyphen-separated decimal numbers, the smallest
 +
and largest bit numbers set in the range. For example, if
 +
you want the container to execute on CPUs 0, 1, 2, 7, you
 +
should pass <b>0-2,7</b>. Default value is <b>all</b> (the
 +
container can execute on any CPU). If used with the
 +
<b>--nodemask</b> option, value of <b>auto</b> assigns all
 +
CPUs from the specified NUMA node to a container.</p>
  
<p style="margin-left:17%; margin-top: 1em">Note that this
+
<p style="margin-left:11%;"><b>--nodemask</b> <i>nodes</i>
command can lead to execution of some action scripts (see
+
| <b>all</b></p>
<b>ACTION SCRIPTS</b> below).</p>
 
  
<p style="margin-left:11%;"><b>status</b></p>
+
<p style="margin-left:22%;">Sets list of allowed NUMA nodes
 +
for the container. Input format is the same as for
 +
<b>--cpumask</b>. Note that <b>--nodemask</b> must be used
 +
with the <b>--cpumask</b> option.</p>
  
<p style="margin-left:17%;">Shows a container status. This
+
==== Memory output parameters ====
is a line with five or six words, separated by spaces.</p>
 
  
<p style="margin-left:17%; margin-top: 1em">First word is
+
<p style="margin-left:11%; margin-top: 1em">For
literally <b>CTID</b>.</p>
+
VSwap-enabled kernels (042stab042 or greater), this
 +
parameter is ignored. For older kernels, it controls the
 +
output of /proc/meminfo inside a container. <b><br>
 +
--meminfo none</b></p>
  
<p style="margin-left:17%; margin-top: 1em">Second word is
+
<p style="margin-left:22%;">No /proc/meminfo virtualization
the numeric <i>CT ID</i>.</p>
+
(the same as on host system).</p>
  
<p style="margin-left:17%; margin-top: 1em">Third word is
+
<p style="margin-left:11%;"><b>--meminfo</b>
showing whether this container exists or not, it can be
+
<i>mode</i>:<i>value</i></p>
either <b>exist</b> or <b>deleted</b>.</p>
 
  
<p style="margin-left:17%; margin-top: 1em">Fourth word is
+
<p style="margin-left:22%;">Configure total memory output
showing the status of the container filesystem, it can be
+
in a container. Reported free memory is evaluated
either <b>mounted</b> or <b>unmounted</b>.</p>
+
accordingly to the mode being set. Reported swap is
 +
evaluated according to the settings of <b>--swappages</b>
 +
parameter.</p>
  
<p style="margin-left:17%; margin-top: 1em">Fifth word
+
<p style="margin-left:22%; margin-top: 1em">You can use the
shows if the container is running, it can be either
+
following modes for <i>mode</i>: <br>
<b>running</b> or <b>down</b>.</p>
+
&bull; <b>pages</b>:<i>value</i> - sets total memory in
 +
pages; <br>
 +
&bull; <b>privvmpages</b>:<i>value</i> - sets total memory
 +
as <b>privvmpages</b> * <i>value</i>.</p>
  
<p style="margin-left:17%; margin-top: 1em">Sixth word, if
+
<p style="margin-left:22%; margin-top: 1em">Default is
exists, is <b>suspended</b>. It appears if both a container
+
<b>privvmpages:1</b>.</p>
and its dump file exist (see <b>chkpnt</b>).</p>
 
  
<p style="margin-left:17%; margin-top: 1em">This command
+
==== Netfilter (iptables) control parameters ====
can also be usable from scripts.</p>
 
  
<p style="margin-left:11%;"><b>mount</b></p>
+
<p style="margin-left:11%;"><b>--netfilter&nbsp;disabled</b>|<b>stateless</b>|<b>stateful</b>|<b>full</b></p>
  
<p style="margin-left:17%;">Mounts container private area.
+
<p style="margin-left:22%;">Restrict access to
Note that this command can lead to execution of
+
netfilter/iptables modules for a container. This option
<b>premount</b> and <b>mount</b> action scripts (see
+
replaces obsoleted <b>--iptables</b>.</p>
<b>ACTION SCRIPTS</b> below).</p>
 
  
<p style="margin-left:11%;"><b>umount</b></p>
+
<p style="margin-left:22%; margin-top: 1em">Note that
 +
changing this parameter requires container restart, so
 +
consider using <b>--setmode</b> option.</p>
 +
 
 +
<p style="margin-left:22%; margin-top: 1em">The following
 +
arguments can be used: <b><br>
 +
&bull; disabled</b></p>
  
<p style="margin-left:17%;">Unmounts container private
+
<p style="margin-left:32%;">no modules are allowed</p>
area. Note that this command can lead to execution of
 
<b>umount</b> and <b>postumount</b> action scripts (see
 
<b>ACTION SCRIPTS</b> below).</p>
 
  
<p style="margin-left:17%; margin-top: 1em">Note that
+
<p style="margin-left:22%;"><b>&bull; stateless</b></p>
<b>stop</b> does <b>umount</b> automatically.</p>
 
  
<p style="margin-left:11%;"><b>quotaon</b> <i>ctid</i></p>
+
<p style="margin-left:32%;">all modules except NAT and
 +
conntracks are allowed (i.e. filter and mangle); this is the
 +
default</p>
  
<p style="margin-left:17%;">Turn disk quota on. Not that
+
<p style="margin-left:22%;"><b>&bull; stateful</b></p>
<b>mount</b> and <b>start</b> does that automatically.</p>
 
  
<p style="margin-left:11%;"><b>quotaoff</b> <i>ctid</i></p>
+
<p style="margin-left:32%;">all modules except NAT are
 +
allowed</p>
  
<p style="margin-left:17%;">Turn disk quota off. Not that
+
<table width="100%" border="0" rules="none" frame="void"
<b>umount</b> and <b>stop</b> does that automatically.</p>
+
      cellspacing="0" cellpadding="0">
 +
<tr valign="top" align="left">
 +
<td width="22%"></td>
 +
<td width="9%">
  
<p style="margin-left:11%;"><b>quotainit</b>
+
<p><b>&bull; full</b></p></td>
<i>ctid</i></p>
+
<td width="1%"></td>
 +
<td width="36%">
  
<p style="margin-left:17%;">Initialize disk quota (i.e. run
+
<p>all modules are allowed</p></td>
<b>vzquota init</b>) with the parameters taken from the CT
+
<td width="32%">
configuration file [[Man/ctid.conf.5|<b>ctid.conf</b>(5)]].</p>
+
</td></tr>
 +
</table>
  
<p style="margin-left:11%;"><b>exec</b> <i>CTID
+
<p style="margin-left:11%;"><b>--iptables</b>
command</i></p>
+
<i>name</i>[<b>,</b>...]</p>
  
<p style="margin-left:17%;">Executes <i>command</i> in a
+
<p style="margin-left:22%;"><b>Note</b> this option is
container. Environment variables are not set inside the
+
obsoleted, <b>--netfilter</b> should be used instead.</p>
container. Signal handlers may differ from default settings.
 
If <i>command</i> is <b>-</b>, commands are read from
 
stdin.</p>
 
  
<p style="margin-left:11%;"><b>exec2</b> <i>CTID
+
<p style="margin-left:22%; margin-top: 1em">Allow to use
command</i></p>
+
the functionality of <i>name</i> iptables module inside the
 +
container. Multiple comma-separated <i>name</i>s can be
 +
specified.</p>
 +
 
 +
<p style="margin-left:22%; margin-top: 1em">The default
 +
list of enabled iptables modules is defined by the
 +
<b>IPTABLES</b> variable in [[Man/vz.conf.5|<b>vz.conf</b>(5)]].</p>
 +
 
 +
<p style="margin-left:22%; margin-top: 1em">You can use the
 +
following values for <i>name</i>: <b>iptable_filter</b>,
 +
<b>iptable_mangle</b>, <b>ipt_limit</b>,
 +
<b>ipt_multiport</b>, <b>ipt_tos</b>, <b>ipt_TOS</b>,
 +
<b>ipt_REJECT</b>, <b>ipt_TCPMSS</b>, <b>ipt_tcpmss</b>,
 +
<b>ipt_ttl</b>, <b>ipt_LOG</b>, <b>ipt_length</b>,
 +
<b>ip_conntrack</b>, <b>ip_conntrack_ftp</b>,
 +
<b>ip_conntrack_irc</b>, <b>ipt_conntrack</b>,
 +
<b>ipt_state</b>, <b>ipt_helper</b>, <b>iptable_nat</b>,
 +
<b>ip_nat_ftp</b>, <b>ip_nat_irc</b>, <b>ipt_REDIRECT</b>,
 +
<b>xt_mac</b>, <b>ipt_recent</b>, <b>ipt_owner</b>.</p>
  
<p style="margin-left:17%;">The same as <b>exec</b>, but
+
==== Network devices control parameters ====
return code is that of <i>command</i>.</p>
 
  
<p style="margin-left:11%;"><b>runscript</b> <i>CTID
+
<p style="margin-left:11%;"><b>--netdev_add</b>
script</i></p>
+
<i>name</i></p>
  
<p style="margin-left:17%;">Run specified shell script in
+
<p style="margin-left:22%;">move network device from the
the container. Argument <i>script</i> is a file on the host
+
host system to a specified container</p>
system which contents is read by vzctl and executed in the
 
context of the container. For a running container, the
 
command jumps into the container and executes the script.
 
For a stopped container, it enters the container, mounts
 
container&rsquo;s root filesystem, executes the script, and
 
unmounts CT root. In the latter case, the container is not
 
really started, no file systems other than root (such as
 
<b>/proc</b>) are mounted, no startup scripts are executed
 
etc. Thus the environment in which the script is running is
 
far from normal and is only usable for very basic
 
operations.</p>
 
  
<p style="margin-left:11%;"><b>enter</b> [<b>--exec</b>
+
<p style="margin-left:11%;"><b>--netdev_del</b>
<i>command</i> [<i>arg</i> ...]]</p>
+
<i>name</i></p>
  
<p style="margin-left:17%;">Enters into a container (giving
+
<p style="margin-left:22%;">delete network device from a
a container&rsquo;s root shell). This option is a back-door
+
specified container</p>
for host root only. The proper way to have CT root shell is
 
to use <b>ssh</b>(1).</p>
 
  
<p style="margin-left:17%; margin-top: 1em">Option
+
==== Disk quota parameters ====
<b>--exec</b> is used to run <i>command</i> with arguments
 
after entering into container. This is useful if command to
 
be run requires a terminal (so <b>vzctl exec</b> can not be
 
used) and for some reason you can not use <b>ssh</b>(1).</p>
 
  
<p style="margin-left:17%; margin-top: 1em">You need to log
+
<p style="margin-left:11%;"><b>--diskquota yes</b> |
out manually from the shell to finish session (even if you
+
<b>no</b></p>
specified <b>--exec</b>).</p>
 
  
=== Other options ===
+
<p style="margin-left:22%;">allows to enable or disable
 +
disk quota for a container. By default, a global value
 +
(<b>DISK_QUOTA</b>) from [[Man/vz.conf.5|<b>vz.conf</b>(5)]] is used.</p>
  
<p style="margin-left:11%;"><b>--help</b></p>
+
<p style="margin-left:22%; margin-top: 1em">Note that this
 +
parameter is ignored for <b>ploop</b> layout.</p>
  
<p style="margin-left:17%;">Prints help message with a
+
<p style="margin-left:11%;"><b>--diskspace</b>
brief list of possible options.</p>
+
<i>num</i>[:<i>num</i>]</p>
  
<p style="margin-left:11%;"><b>--version</b></p>
+
<p style="margin-left:22%;">For <b>simfs</b> layout, sets
 +
soft and hard disk quota limits. First parameter is soft
 +
limit, second is hard limit.</p>
  
<p style="margin-left:17%;">Prints <b>vzctl</b>
+
<p style="margin-left:22%; margin-top: 1em">For
version.</p>
+
<b>ploop</b> layout, initiates the procedure of resizing the
 +
ploop image file to the new size. Since there is no
 +
soft/hard limit concept in ploop, second <i>num</i>, if
 +
specified, is ignored.</p>
  
== ACTION SCRIPTS ==
+
<p style="margin-left:22%; margin-top: 1em">By default,
 +
ploop resize is done online, i.e. on a mounted ploop. This
 +
is a preferred way of doing resize. Although, in a rare case
 +
a container was using lots of disk space and should now be
 +
resized to a much smaller size, an offline resize might be
 +
more appropriate. In this case, make sure the container is
 +
stopped and unmounted and use additional
 +
<b>--offline-resize</b> option</p>
  
<p style="margin-left:11%; margin-top: 1em"><b>vzctl</b>
+
<p style="margin-left:22%; margin-top: 1em">Note that ploop
has an ability to execute user-defined scripts when a
+
resize is NOT performed on container start, so for
specific <b>vzctl</b> command is run for a container. The
+
consistency <b>--diskspace</b> must be used together with
following <b>vzctl</b> commands can trigger execution of
+
<b>--save</b> flag.</p>
action scripts: <b>start</b>, <b>stop</b>, <b>restart</b>,
 
<b>mount</b> and <b>umount</b>.</p>
 
  
<p style="margin-left:11%; margin-top: 1em">Action scripts
+
<p style="margin-left:22%; margin-top: 1em">Suffixes
are located in the <b>/etc/vz/conf/</b> directory. There are
+
<b>G</b>, <b>M</b>, <b>K</b> can also be specified (see
global and per-CT scripts. Global scripts have a literal
+
<b>Resource limits</b> section for more info on suffixes).
prefix of <b>vps.</b> and are executed for all containers.
+
If suffix is not specified, value is in kilobytes.</p>
Per-CT scripts have a <i>CTID</i> numeric prefix and are
 
executed for the given container only.</p>
 
  
<p style="margin-left:11%; margin-top: 1em">There are 8
+
<p style="margin-left:11%;"><b>--diskinodes</b>
action scripts currently defined: <b><br>
+
<i>num</i>[:<i>num</i>]</p>
vps.premount</b>, <i>CTID</i><b>.premount</b></p>
 
  
<p style="margin-left:22%;">Global and per-CT mount scripts
+
<p style="margin-left:22%;">sets soft and hard disk quota
which are executed for a container before it is mounted.
+
limits, in i-nodes. First parameter is soft limit, second is
Scripts are executed in the host OS context, while a CT is
+
hard limit.</p>
not yet mounted or running. Global script, if exists, is
 
executed first.</p>
 
  
<p style="margin-left:11%;"><b>vps.mount</b>,
+
<p style="margin-left:22%; margin-top: 1em">Note that this
<i>CTID</i><b>.mount</b></p>
+
parameter is ignored for <b>ploop</b> layout.</p>
  
<p style="margin-left:22%;">Global and per-CT mount scripts
+
<p style="margin-left:11%;"><b>--quotatime</b>
which are executed for a container right after it is
+
<i>seconds</i></p>
mounted. Otherwise they are the same as <b>.premount</b>
 
scripts.</p>
 
  
<p style="margin-left:11%;"><i>CTID</i><b>.start</b></p>
+
<p style="margin-left:22%;">sets quota grace period.
 +
Container is permitted to exceed its soft limits for the
 +
grace period, but once it has expired, the soft limit is
 +
enforced as a hard limit.</p>
  
<p style="margin-left:22%;">Right after <b>vzctl</b> has
+
<p style="margin-left:22%; margin-top: 1em">Note that this
started a container, it executes this script in a container
+
parameter is ignored for <b>ploop</b> layout.</p>
context.</p>
 
  
<p style="margin-left:11%;"><i>CTID</i><b>.stop</b></p>
+
<p style="margin-left:11%;"><b>--quotaugidlimit</b>
 +
<i>num</i></p>
  
<p style="margin-left:22%;">Right before <b>vzctl</b> has
+
<p style="margin-left:22%;">Enables or disables
stopped a container, it executes this script in a container
+
in-container per-user and per-group disk quotas. If the
context.</p>
+
value is set to <b>0</b> or not set, disk quotas inside the
 +
container is disabled and not accounted.</p>
  
<p style="margin-left:11%;"><b>vps.umount</b>,
+
<p style="margin-left:22%; margin-top: 1em">For
<i>CTID</i><b>.umount</b></p>
+
<b>simfs</b> layout containers, non-zero value sets maximum
 +
number of user/group IDs for which disk quota is
 +
accounted.</p>
  
<p style="margin-left:22%;">Global and per-CT umount
+
<p style="margin-left:22%; margin-top: 1em">For
scripts which are executed for a container before it is
+
<b>ploop</b> layout containers, any non-zero value enables
unmounted. Scripts are executed in the host OS context,
+
disk quota inside the container; the number of user/group
while a CT is mounted. Global script, if exists, is executed
+
IDs used by disk quota is not limited by OpenVZ.</p>
first.</p>
 
  
<p style="margin-left:11%;"><b>vps.postumount</b>,
+
<p style="margin-left:22%; margin-top: 1em">Note that
<i>CTID</i><b>.postumount</b></p>
+
enabling or disabling in-container disk quotas requires
 +
container restart, so consider using <b>--setmode</b>
 +
option.</p>
  
<p style="margin-left:22%;">Global and per-CT umount
+
==== Capability option ====
scripts which are executed for a container right after it is
 
unmounted. Otherwise they are the same as <b>.umount</b>
 
scripts.</p>
 
  
<p style="margin-left:22%; margin-top: 1em">The environment
+
<p style="margin-left:11%;"><b>--capability</b>
passed to all the <b>*mount</b> scripts is the standard
+
<i>capname</i>:<b>on</b>|<b>off</b>[<b>,</b>...]</p>
environment of the parent (i.e. <b>vzctl</b>) with two
 
additional variables: <b>$VEID</b> and <b>$VE_CONFFILE</b>.
 
The first one holds the ID of the container, and the second
 
one holds the full path to the container configuration file.
 
If the script needs to get other CT configuration
 
parameters, such as <b>$VE_ROOT</b>, it needs to get those
 
from global and per-CT configuration files.</p>
 
  
<p style="margin-left:22%; margin-top: 1em">Here is an
+
<p style="margin-left:22%;">Sets a capability for a
example of a mount script, which makes host system&rsquo;s
+
container. Multiple comma-separated capabilities can be
/mnt/disk available to container(s). Script name can either
+
specified.</p>
be <b>/etc/vz/conf/vps.mount</b> or
 
<b>/etc/vz/conf/</b><i>CTID</i><b>.mount</b>.</p>
 
  
<p style="margin-left:22%; margin-top: 1em"># If one of
+
<p style="margin-left:22%; margin-top: 1em">Note that
these files does not exist then something <br>
+
setting a capability when the container is running does not
# is really broken <br>
+
take immediate effect; restart the container in order for
[ -f /etc/sysconfig/vz ] || exit 1 <br>
+
the changes to take effect (consider using <b>--setmode</b>
[ -f $VE_CONFFILE ] || exit 1 <br>
+
option).</p>
# Source both files. Note the order is important. <br>
 
. /etc/vz/vz.conf <br>
 
. $VE_CONFFILE <br>
 
mount -n --bind /mnt/disk $VE_ROOT/mnt/disk</p>
 
  
== EXIT STATUS ==
+
<p style="margin-left:22%; margin-top: 1em">A container has
 +
the default set of capabilities, thus any operation on
 +
capabilities is &quot;logical AND&quot; with the default
 +
capability mask.</p>
  
<p style="margin-left:11%; margin-top: 1em">Returns 0 upon
+
<p style="margin-left:22%; margin-top: 1em">You can use the
success, or an appropriate error code in case of an
+
following values for <i>capname</i>: <b>chown</b>,
error:</p>
+
<b>dac_override</b>, <b>dac_read_search</b>, <b>fowner</b>,
 +
<b>fsetid</b>, <b>kill</b>, <b>setgid</b>, <b>setuid</b>,
 +
<b>setpcap</b>, <b>linux_immutable</b>,
 +
<b>net_bind_service</b>, <b>net_broadcast</b>,
 +
<b>net_admin</b>, <b>net_raw</b>, <b>ipc_lock</b>,
 +
<b>ipc_owner</b>, <b>sys_module</b>, <b>sys_rawio</b>,
 +
<b>sys_chroot</b>, <b>sys_ptrace</b>, <b>sys_pacct</b>,
 +
<b>sys_admin</b>, <b>sys_boot</b>, <b>sys_nice</b>,
 +
<b>sys_resource</b>, <b>sys_time</b>, <b>sys_tty_config</b>,
 +
<b>mknod</b>, <b>lease</b>, <b>setveid</b>, <b>ve_admin</b>.
 +
For detailed description, see <b>capabilities</b>(7).</p>
 +
 
 +
<p style="margin-left:22%; margin-top: 1em"><b>WARNING</b>:
 +
setting some of those capabilities may have far reaching
 +
security implications, so do not do it unless you know what
 +
you are doing. Also note that setting <b>setpcap:on</b> for
 +
a container will most probably lead to inability to start
 +
it.</p>
  
<table width="100%" border="0" rules="none" frame="void"
+
==== Device access management ====
      cellspacing="0" cellpadding="0">
 
<tr valign="top" align="left">
 
<td width="11%"></td>
 
<td width="4%">
 
  
<p>1</p></td>
+
<p style="margin-left:11%;"><b>--devnodes</b>
<td width="7%"></td>
+
<i>device</i>:[<b>r</b>][<b>w</b>][<b>q</b>]|<b>none</b></p>
<td width="78%">
+
 
 +
<p style="margin-left:22%;">Give the container an access
 +
(<b>r</b> - read, <b>w</b> - write, <b>q</b> - disk quota
 +
management, <b>none</b> - no access) to a device designated
 +
by the special file /dev/<i>device</i>. Device file is
 +
created in a container by <b>vzctl</b>. Example:</p>
 +
 
 +
<pre style="margin-left:22%;">  vzctl set 777 --devnodes sdb:rwq</pre>
  
<p>Failed to set a UBC parameter</p></td></tr>
+
<p style="margin-left:11%;"><b>--devices
<tr valign="top" align="left">
+
b</b>|<b>c</b>:<i>major</i>:<i>minor</i>|<b>all</b>:[<b>r</b>][<b>w</b>][<b>q</b>]|<b>none</b></p>
<td width="11%"></td>
 
<td width="4%">
 
  
<p>2</p></td>
+
<p style="margin-left:22%;">Give the container an access to
<td width="7%"></td>
+
a <b>b</b>lock or <b>c</b>haracter device designated by its
<td width="78%">
+
<i>major</i> and <i>minor</i> numbers. Device file have to
 +
be created manually.</p>
  
<p>Failed to set a fair scheduler parameter</p></td></tr>
+
==== PCI device management ====
<tr valign="top" align="left">
 
<td width="11%"></td>
 
<td width="4%">
 
  
<p>3</p></td>
+
<p style="margin-left:11%;"><b>--pci_add</b>
<td width="7%"></td>
+
[<i>domain</i>:]<i>bus</i>:<i>slot</i>.<i>func</i></p>
<td width="78%">
 
  
<p>Generic system error</p></td></tr>
+
<p style="margin-left:22%;">Give the container an access to
<tr valign="top" align="left">
+
a specified PCI device. All numbers are hexadecimal (as
<td width="11%"></td>
+
printed by <b>lspci</b>(8) in the first column).</p>
<td width="4%">
+
 
 +
<p style="margin-left:11%;"><b>--pci_del</b>
 +
[<i>domain</i>:]<i>bus</i>:<i>slot</i>.<i>func</i></p>
  
<p>5</p></td>
+
<p style="margin-left:22%;">Delete a PCI device from the
<td width="7%"></td>
+
container.</p>
<td width="78%">
 
  
<p>The running kernel is not an OpenVZ kernel (or some
+
<p style="margin-left:22%; margin-top: 1em">Note that
OpenVZ modules are not loaded)</p></td></tr>
+
<b>vps-pci</b> configuration script is executed by
<tr valign="top" align="left">
+
<b>vzctl</b> then configuring PCI devices. The script is
<td width="11%"></td>
+
usually located at <b>/usr/libexec/vzctl/scripts/</b>.</p>
<td width="4%">
 
  
<p>6</p></td>
+
==== Features management ====
<td width="7%"></td>
 
<td width="78%">
 
  
<p>Not enough system resources</p></td></tr>
+
<p style="margin-left:11%;"><b>--features</b>
<tr valign="top" align="left">
+
<i>name</i>:<b>on</b>|<b>off</b>[<b>,</b>...]</p>
<td width="11%"></td>
 
<td width="4%">
 
  
<p>7</p></td>
+
<p style="margin-left:22%;">Enable or disable a specific
<td width="7%"></td>
+
container feature. Known features are: <b>sysfs</b>,
<td width="78%">
+
<b>nfs</b>, <b>sit</b>, <b>ipip</b>, <b>ppp</b>,
 +
<b>ipgre</b>, <b>bridge</b>, <b>nfsd</b>. A few features can
 +
be specified at once, comma-separated.</p>
  
<p><b>ENV_CREATE</b> ioctl failed</p></td></tr>
+
==== Apply config ====
<tr valign="top" align="left">
 
<td width="11%"></td>
 
<td width="4%">
 
  
<p>8</p></td>
+
<p style="margin-left:11%;"><b>--applyconfig</b>
<td width="7%"></td>
+
<i>name</i></p>
<td width="78%">
 
  
<p>Command executed by <b>vzctl exec</b> returned non-zero
+
<p style="margin-left:22%;">Read container parameters from
exit code</p></td></tr>
+
the container sample configuration file
<tr valign="top" align="left">
+
<tt>/etc/vz/conf/ve-</tt><i>name</i><tt>.conf-sample</tt>,
<td width="11%"></td>
+
and apply them, if <b>--save</b> option specified save to
<td width="4%">
+
the container config file. The following parameters are not
 +
changed: <b>HOSTNAME</b>, <b>IP_ADDRESS</b>,
 +
<b>OSTEMPLATE</b>, <b>VE_ROOT</b>, and
 +
<b>VE_PRIVATE</b>.</p>
  
<p>9</p></td>
+
<p style="margin-left:11%;"><b>--applyconfig_map</b>
<td width="7%"></td>
+
<i>group</i></p>
<td width="78%">
 
  
<p>Container is locked by another <b>vzctl</b>
+
<p style="margin-left:22%;">Apply container config
invocation</p> </td></tr>
+
parameters selected by <i>group</i>. Now the only possible
<tr valign="top" align="left">
+
value for <i>group</i> is <b>name</b>: to restore container
<td width="11%"></td>
+
name based on <b>NAME</b> variable in container
<td width="4%">
+
configuration file.</p>
  
<p>10</p></td>
+
==== I/O scheduling ====
<td width="7%"></td>
 
<td width="78%">
 
  
<p>Global OpenVZ configuration file [[Man/vz.conf.5|<b>vz.conf</b>(5)]] not
+
<p style="margin-left:11%;"><b>--ioprio</b>
found</p> </td></tr>
+
<i>priority</i></p>
<tr valign="top" align="left">
 
<td width="11%"></td>
 
<td width="4%">
 
  
<p>11</p></td>
+
<p style="margin-left:22%;">Assigns disk I/O priority to
<td width="7%"></td>
+
container. <i>Priority</i> range is <b>0-7</b>. The greater
<td width="78%">
+
<i>priority</i> is, the more time for I/O activity container
 +
has. By default each container has <i>priority</i> of
 +
<b>4</b>.</p>
 +
 
 +
<p style="margin-left:11%;"><b>--iolimit</b>
 +
<i>limit</i>[<b>B</b>|<b>K</b>|<b>M</b>|<b>G</b>]</p>
 +
 
 +
<p style="margin-left:22%;">Assigns disk I/O bandwidth
 +
limit for a container. Value is either a number with an
 +
optional suffix, or a literal string <b>unlimited</b>. Value
 +
of <b>0</b> means &quot;unlimited&quot;. By default a
 +
container has no I/O limit. Maximum allowed limit is 2
 +
gigabytes per second; values exceeding the limit are
 +
truncated.</p>
  
<p>A vzctl helper script file not found</p></td></tr>
+
<p style="margin-left:22%; margin-top: 1em">If no suffix is
<tr valign="top" align="left">
+
provided, the <i>limit</i> is assumed to be in megabytes per
<td width="11%"></td>
+
second. Available suffixes are: <br>
<td width="4%">
+
&bull; <b>b</b>, <b>B</b> -- bytes per second; <br>
 +
&bull; <b>k</b>, <b>K</b> -- kilobytes per second; <br>
 +
&bull; <b>m</b>, <b>M</b> -- megabytes per second (default);
 +
<br>
 +
&bull; <b>g</b>, <b>G</b> -- gigabytes per second;</p>
  
<p>12</p></td>
+
<p style="margin-left:11%;"><b>--iopslimit</b>
<td width="7%"></td>
+
<i>iops</i></p>
<td width="78%">
 
  
<p>Permission denied</p></td></tr>
+
<p style="margin-left:22%;">Assigns IOPS limit for a
<tr valign="top" align="left">
+
container, in number of input/output operations per second.
<td width="11%"></td>
+
Value is a number or a literal string <b>unlimited</b>.
<td width="4%">
+
Value of <b>0</b> means &quot;unlimited&quot;. By default a
 +
container has no IOPS limit.</p>
  
<p>13</p></td>
+
=== Suspending and resuming ===
<td width="7%"></td>
 
<td width="78%">
 
  
<p>Capability setting failed</p></td></tr>
+
<p style="margin-top: 1em">Checkpointing is a feature of
<tr valign="top" align="left">
+
OpenVZ kernel which allows to save a complete in-kernel
<td width="11%"></td>
+
state of a running container, and to restore it later.</p>
<td width="4%">
 
  
<p>14</p></td>
+
<p style="margin-left:11%;"><b>suspend</b>|<b>chkpnt</b>
<td width="7%"></td>
+
<i>CTID</i> [<b>--dumpfile</b> <i>name</i>]</p>
<td width="78%">
 
  
<p>Container configuration file [[Man/ctid.conf.5|<b>ctid.conf</b>(5)]] not
+
<p style="margin-left:17%;">This command suspends a
found</p> </td></tr>
+
container to a dump file If an option <b>--dumpfile</b> is
<tr valign="top" align="left">
+
not set, default dump file name
<td width="11%"></td>
+
<b>/vz/dump/Dump.</b><i>CTID</i> is used.</p>
<td width="4%">
+
 
 +
<p style="margin-left:11%;"><b>resume</b>|<b>restore</b>
 +
<i>CTID</i> [<b>--dumpfile</b> <i>name</i>]</p>
  
<p>15</p></td>
+
<p style="margin-left:17%;">This command restores a
<td width="7%"></td>
+
container from the dump file created by the <b>suspend</b>
<td width="78%">
+
command.</p>
  
<p>Timeout on <b>vzctl exec</b></p></td></tr>
+
=== Snapshotting ===
<tr valign="top" align="left">
 
<td width="11%"></td>
 
<td width="4%">
 
  
<p>16</p></td>
+
<p style="margin-top: 1em">Snapshotting is a feature based
<td width="7%"></td>
+
on checkpointing and ploop shapshots. It allows to save a
<td width="78%">
+
complete state of container file system. Plus, if the
 +
container is running, it&rsquo;s in-memory state (as in
 +
checkpointing). Note that snapshot functionality is only
 +
working for containers on ploop device.</p>
  
<p>Error during <b>vzctl chkpnt</b></p></td></tr>
+
<p style="margin-left:11%;"><b>snapshot</b> <i>CTID</i>
<tr valign="top" align="left">
+
[<b>--id</b> <i>uuid</i>] [<b>--name</b> <i>name</i>]
<td width="11%"></td>
+
[<b>--description</b> <i>desc</i>] <br>
<td width="4%">
+
[<b>--skip-suspend</b>] [<b>--skip-config</b>]</p>
  
<p>17</p></td>
+
<p style="margin-left:17%;">Creates a container snapshot,
<td width="7%"></td>
+
i.e. saves the current container state, including its file
<td width="78%">
+
system state, running processes state, and configuration
 +
file.</p>
  
<p>Error during <b>vzctl restore</b></p></td></tr>
+
<p style="margin-left:17%; margin-top: 1em">If a container
<tr valign="top" align="left">
+
is running, and <b>--skip-suspend</b> option is not
<td width="11%"></td>
+
specified, a container is checkpointed and then restored,
<td width="4%">
+
and CT memory dump becomes the part of snapshot.</p>
  
<p>18</p></td>
+
<p style="margin-left:17%; margin-top: 1em">Unless
<td width="7%"></td>
+
<b>--skip-config</b> option is given, container
<td width="78%">
+
configuration file is saved to the snapshot.</p>
  
<p>Error from <b>setluid()</b> syscall</p></td></tr>
+
<p style="margin-left:17%; margin-top: 1em">If <i>uuid</i>
<tr valign="top" align="left">
+
is not specified, it is auto-generated. Options
<td width="11%"></td>
+
<b>--name</b> and <b>--description</b> can be used to
<td width="4%">
+
specify the snapshot name and description, respectively.
 +
Name is displayed by <b>snapshot-list</b>.</p>
 +
 
 +
<p style="margin-left:11%;"><b>snapshot-switch</b>
 +
<i>CTID</i> [<b>--skip-resume</b> | <b>--must-resume</b>]
 +
[<b>--skip-config</b>] <b><br>
 +
--id</b> <i>uuid</i></p>
  
<p>20</p></td>
+
<p style="margin-left:17%;">Switches the container to a
<td width="7%"></td>
+
snapshot identified by <i>uuid</i>, restoring its file
<td width="78%">
+
system state, configuration (if available) and its running
 +
state (if available).</p>
  
<p>Invalid command line parameter</p></td></tr>
+
<p style="margin-left:17%; margin-top: 1em"><b>Note that
<tr valign="top" align="left">
+
the current state of a container (including its file system
<td width="11%"></td>
+
state and its configuration file) is lost!</b></p>
<td width="4%">
 
  
<p>21</p></td>
+
<p style="margin-left:17%; margin-top: 1em">Option
<td width="7%"></td>
+
<b>--skip-resume</b> is used to ignore a CT memory dump file
<td width="78%">
+
in a snapshot, as a result the container will end up being
 +
in a stopped state (same as if a snapshot has been taken
 +
with <b>--skip-suspend</b>).</p>
  
<p>Invalid value for command line parameter</p></td></tr>
+
<p style="margin-left:17%; margin-top: 1em">If option
<tr valign="top" align="left">
+
<b>--must-resume</b> is set, absense of a memory dump is
<td width="11%"></td>
+
treated as an error, and the inability to restore from the
<td width="4%">
+
memory dump is treated as an error rather than warning.</p>
  
<p>22</p></td>
+
<p style="margin-left:17%; margin-top: 1em">Option option
<td width="7%"></td>
+
<b>--skip-config</b> is used to ignore the CT configuration
<td width="78%">
+
file in a snapshot, i.e. the current configuration file will
 +
be left as is.</p>
  
<p>Container root directory (<b>VE_ROOT</b>) not set</p></td></tr>
+
<p style="margin-left:11%;"><b>snapshot-delete</b>
<tr valign="top" align="left">
+
<i>CTID</i> <b>--id</b> <i>uuid</i></p>
<td width="11%"></td>
 
<td width="4%">
 
  
<p>23</p></td>
+
<p style="margin-left:17%;">Removes a specified
<td width="7%"></td>
+
snapshot.</p>
<td width="78%">
+
 
 +
<p style="margin-left:11%;"><b>snapshot-mount</b>
 +
<i>CTID</i> <b>--id</b> <i>uuid</i> <b>--target</b>
 +
<i>directory</i></p>
 +
 
 +
<p style="margin-left:17%;">Mounts a snapshot specified by
 +
<i>uuid</i> to a <i>directory</i>. Note this mount is
 +
read-only.</p>
 +
 
 +
<p style="margin-left:11%;"><b>snapshot-umount</b>
 +
<i>CTID</i> <b>--id</b> <i>uuid</i></p>
 +
 
 +
<p style="margin-left:17%;">Unmounts a specified
 +
snapshot.</p>
 +
 
 +
<p style="margin-left:11%;"><b>snapshot-list</b>
 +
<i>CTID</i> [<b>-H</b>] [<b>-o</b>
 +
<i>field</i>[,<i>field</i>...] [<b>--id</b> <i>uuid</i>]</p>
 +
 
 +
<p style="margin-left:17%;">List container&rsquo;s
 +
snapshots.</p>
 +
 
 +
<p style="margin-left:17%; margin-top: 1em">You can
 +
suppress displaying header using <b>-H</b> option.</p>
  
<p>Container private directory (<b>VE_PRIVATE</b>) not
+
<p style="margin-left:17%; margin-top: 1em">You can use the
set</p> </td></tr>
+
<b>-o</b> option to display only the specified
<tr valign="top" align="left">
+
<i>field</i>(s). List of available fields can be obtained
<td width="11%"></td>
+
using <b>-L</b> option.</p>
<td width="4%">
 
  
<p>24</p></td>
+
=== Performing container actions ===
<td width="7%"></td>
 
<td width="78%">
 
  
<p>Container template directory (<b>TEMPLATE</b>) not
+
<table width="100%" border="0" rules="none" frame="void"
set</p> </td></tr>
+
      cellspacing="0" cellpadding="0">
 
<tr valign="top" align="left">
 
<tr valign="top" align="left">
 
<td width="11%"></td>
 
<td width="11%"></td>
<td width="4%">
+
<td width="9%">
  
<p>28</p></td>
+
<p style="margin-top: 1em"><b>create</b></p></td>
<td width="7%"></td>
+
<td width="2%"></td>
 
<td width="78%">
 
<td width="78%">
  
<p>Not all required UBC parameters are set, unable to start
+
<p style="margin-top: 1em"><i>CTID</i>
container</p> </td></tr>
+
[<b>--ostemplate&nbsp;</b><i>name</i>]
<tr valign="top" align="left">
+
[<b>--config&nbsp;</b><i>name</i>]
<td width="11%"></td>
+
[<b>--layout&nbsp;simfs</b>|<b>ploop</b>[<b>:</b>{<b>expanded</b>|<b>plain</b>|<b>raw</b>}]]
<td width="4%">
+
[<b>--diskspace&nbsp;</b><i>kbytes</i>]
 +
[<b>--diskinodes&nbsp;</b><i>num</i>]
 +
[<b>--private&nbsp;</b><i>path</i>]
 +
[<b>--root&nbsp;</b><i>path</i>]
 +
[<b>--ipadd&nbsp;</b><i>addr</i>]
 +
[<b>--hostname&nbsp;</b><i>name</i>]
 +
[<b>--name&nbsp;</b><i>name</i>]
 +
[<b>--local_uid&nbsp;</b><i>uid</i>]
 +
[<b>--local_gid&nbsp;</b><i>gid</i>]</p> </td></tr>
 +
</table>
 +
 
 +
<p style="margin-left:17%; margin-top: 1em">Creates a new
 +
container area. This operation should be done once, before
 +
the first start of the container.</p>
  
<p>29</p></td>
+
<p style="margin-left:17%; margin-top: 1em">By default, an
<td width="7%"></td>
+
OS template denoted by <b>DEF_OSTEMPLATE</b> parameter of
<td width="78%">
+
[[Man/vz.conf.5|<b>vz.conf</b>(5)]] is used to create a container. This can be
 +
overwritten by <b>--ostemplate</b> option.</p>
  
<p>OS template is not specified, unable to create
+
<p style="margin-left:17%; margin-top: 1em">By default, a
container</p> </td></tr>
+
new container configuration file is created from a sample
<tr valign="top" align="left">
+
configuration denoted by value of <b>CONFIGFILE</b>
<td width="11%"></td>
+
parameter of [[Man/vz.conf.5|<b>vz.conf</b>(5)]]. If the container
<td width="4%">
+
configuration file already exists, it will not be
 +
modified.</p>
  
<p>31</p></td>
+
<p style="margin-left:17%; margin-top: 1em">The value of
<td width="7%"></td>
+
<b>CONFIGFILE</b> can be overwritten by using the
<td width="78%">
+
<b>--config</b> <i>name</i> option. This option can not be
 +
used if the container configuration file already exists.</p>
  
<p>Container not running</p></td></tr>
+
<p style="margin-left:17%; margin-top: 1em">A new container
<tr valign="top" align="left">
+
can either be created using <b>simfs</b> filesystem or on a
<td width="11%"></td>
+
<b>ploop</b> device. The default is set by value of
<td width="4%">
+
<b>VE_LAYOUT</b> parameter of [[Man/vz.conf.5|<b>vz.conf</b>(5)]] and can be
 +
overwritten by <b>--layout</b> option. In case <b>ploop</b>
 +
is used, one can additionally specify ploop disk image
 +
format after a colon. Possible ploop formats are
 +
<b>expanded</b>, <b>plain</b> and <b>raw</b>. Default is
 +
<b>expanded</b>. Using value other than <b>expanded</b> is
 +
not recommended and is currently not supported.</p>
  
<p>32</p></td>
+
<p style="margin-left:17%; margin-top: 1em">You can use
<td width="7%"></td>
+
<b>--diskspace</b> and <b>--diskinodes</b> options to
<td width="78%">
+
specify container file system size. Note that for
 +
<b>ploop</b> layout, you will not be able to change inodes
 +
value later.</p>
  
<p>Container already running</p></td></tr>
+
<p style="margin-left:17%; margin-top: 1em">If
<tr valign="top" align="left">
+
<b>DISKSPACE</b> is not specified either in the sample
<td width="11%"></td>
+
configuration file used for creation or in global
<td width="4%">
+
configuration file [[Man/vz.conf.5|<b>vz.conf</b>(5)]], <b>--diskspace</b>
 +
parameter is required for <b>ploop</b> layout.</p>
  
<p>33</p></td>
+
<p style="margin-left:17%; margin-top: 1em">Suffixes
<td width="7%"></td>
+
<b>G</b>, <b>M</b>, <b>K</b> can also be specified (see
<td width="78%">
+
<b>Resource limits</b> section for more info on
 +
suffixes).</p>
  
<p>Unable to stop container</p></td></tr>
+
<p style="margin-left:17%; margin-top: 1em">You can use
<tr valign="top" align="left">
+
<b>--root</b> <i>path</i> option to sets the path to the
<td width="11%"></td>
+
mount point for the container root directory (default is
<td width="4%">
+
<b>VE_ROOT</b> specified in [[Man/vz.conf.5|<b>vz.conf</b>(5)]] file).
 +
Argument can contain literal string <b>$VEID</b>, which will
 +
be substituted with the numeric CT ID.</p>
  
<p>34</p></td>
+
<p style="margin-left:17%; margin-top: 1em">You can use
<td width="7%"></td>
+
<b>--private</b> <i>path</i> option to set the path to
<td width="78%">
+
directory in which all the files and directories specific to
 +
this very container are stored (default is <b>VE_PRIVATE</b>
 +
specified in [[Man/vz.conf.5|<b>vz.conf</b>(5)]] file). Argument can contain
 +
literal string <b>$VEID</b>, which will be substituted with
 +
the numeric CT ID.</p>
  
<p>Unable to add IP address to container</p></td></tr>
+
<p style="margin-left:17%; margin-top: 1em">You can use
<tr valign="top" align="left">
+
<b>--ipadd</b> <i>addr</i> option to assign an IP address to
<td width="11%"></td>
+
a container. Note that this option can be used multiple
<td width="4%">
+
times.</p>
  
<p>40</p></td>
+
<p style="margin-left:17%; margin-top: 1em">You can use
<td width="7%"></td>
+
<b>--hostname</b> <i>name</i> option to set a host name for
<td width="78%">
+
a container.</p>
  
<p>Container not mounted</p></td></tr>
+
<p style="margin-left:17%; margin-top: 1em">When running
<tr valign="top" align="left">
+
with an upstream Linux Kernel that supports user namespaces
<td width="11%"></td>
+
(&gt;= 3.8), the parameters <b>--local_uid</b> and
<td width="4%">
+
<b>--local_gid</b> can be used to select which <i>uid</i>
 +
and <i>gid</i> respectively will be used as a base user in
 +
the host system. Note that user namespaces provide a 1:1
 +
mapping between container users and host users. If these
 +
options are not specified, the values <b>LOCAL_UID</b> and
 +
<b>LOCAL_GID</b> from global configuration file
 +
[[Man/vz.conf.5|<b>vz.conf</b>(5)]] are used. An explicit <b>--local_uid</b>
 +
value of 0 will disable user namespace support, and run the
 +
container as a privileged user. In this case,
 +
<b>--local_gid</b> is ignored.</p>
  
<p>41</p></td>
+
<p style="margin-left:17%; margin-top: 1em"><b>Warning:</b>
<td width="7%"></td>
+
use <b>--local_uid</b> and <b>--local_gid</b> with care,
<td width="78%">
+
specially when migrating containers. In all situations, the
 +
container&rsquo;s files in the filesystem needs to be
 +
correctly owned by the host-side users.</p>
  
<p>Container already mounted</p></td></tr>
+
<p style="margin-left:11%;"><b>destroy</b> | <b>delete</b>
<tr valign="top" align="left">
+
<i>CTID</i></p>
<td width="11%"></td>
 
<td width="4%">
 
  
<p>43</p></td>
+
<p style="margin-left:17%;">Removes a container private
<td width="7%"></td>
+
area by deleting all files, directories and the
<td width="78%">
+
configuration file of this container.</p>
  
<p>Container private area not found</p></td></tr>
+
<p style="margin-left:11%;"><b>start</b> <i>CTID</i>
<tr valign="top" align="left">
+
[<b>--wait</b>] [<b>--force</b>] [<b>--skip-fsck</b>]
<td width="11%"></td>
+
[<b>--skip-remount</b>]</p>
<td width="4%">
 
  
<p>44</p></td>
+
<p style="margin-left:17%;">Mounts (if necessary) and
<td width="7%"></td>
+
starts a container. Unless <b>--wait</b> option is
<td width="78%">
+
specified, <b>vzctl</b> will return immediately; otherwise
 +
an attempt to wait till the default runlevel is reached will
 +
be made by <b>vzctl</b>.</p>
  
<p>Container private area already exists</p></td></tr>
+
<p style="margin-left:17%; margin-top: 1em">Specify
<tr valign="top" align="left">
+
<b>--force</b> if you want to start a container which is
<td width="11%"></td>
+
disabled (see <b>--disabled</b>).</p>
<td width="4%">
 
  
<p>46</p></td>
+
<p style="margin-left:17%; margin-top: 1em">Specify
<td width="7%"></td>
+
<b>--skip-fsck</b> to skip fsck for ploop-based container
<td width="78%">
+
filesystem (this option is used by vz initscript).</p>
  
<p>Not enough disk space</p></td></tr>
+
<p style="margin-left:17%; margin-top: 1em">By default, if
<tr valign="top" align="left">
+
a container to be started happens to be already mounted, it
<td width="11%"></td>
+
is unmounted and mounted again. This behavior can be turned
<td width="4%">
+
off by using <b>--skip-remount</b> flag.</p>
  
<p>47</p></td>
+
<p style="margin-left:17%; margin-top: 1em">Note that this
<td width="7%"></td>
+
command can lead to execution of <b>premount</b>,
<td width="78%">
+
<b>mount</b> and <b>start</b> action scripts (see <b>ACTION
 +
SCRIPTS</b> below).</p>
  
<p>Bad/broken container (<b>/sbin/init</b> or
+
<p style="margin-left:11%;"><b>stop</b> <i>CTID</i>
<b>/bin/sh</b> not found)</p></td></tr>
+
[<b>--fast</b>] [<b>--skip-umount</b>]</p>
<tr valign="top" align="left">
 
<td width="11%"></td>
 
<td width="4%">
 
  
<p>48</p></td>
+
<p style="margin-left:17%;">Stops a container and unmounts
<td width="7%"></td>
+
it (unless <b>--skip-umount</b> is given). Normally,
<td width="78%">
+
<b>halt</b>(8) is executed inside a container; option
 +
<b>--fast</b> makes <b>vzctl</b> use <b>reboot</b>(2)
 +
syscall instead which is faster but can lead to unclean
 +
container shutdown.</p>
  
<p>Unable to create a new container private area</p></td></tr>
+
<p style="margin-left:17%; margin-top: 1em">Note that
<tr valign="top" align="left">
+
<b>vzctl stop</b> is not asyncronous, in other words vzctl
<td width="11%"></td>
+
waits for container&rsquo;s init to exit (unless
<td width="4%">
+
<b>--fast</b> is given), which can take up to a few minutes.
 +
Default wait timeout is 120 seconds; it can be changed
 +
globally, by setting <b>STOP_TIMEOUT</b> in
 +
[[Man/vz.conf.5|<b>vz.conf</b>(5)]], or per container (<b>STOP_TIMEOUT</b> in
 +
[[Man/ctid.conf.5|<b>ctid.conf</b>(5)]], see <b>--stop-timeout</b>).</p>
  
<p>49</p></td>
+
<p style="margin-left:17%; margin-top: 1em">Note that this
<td width="7%"></td>
+
command can lead to execution of <b>stop</b>, <b>umount</b>
<td width="78%">
+
and <b>postumount</b> action scripts (see <b>ACTION
 +
SCRIPTS</b> below).</p>
  
<p>Unable to create a new container root area</p></td></tr>
+
<p style="margin-left:11%;"><b>restart</b> <i>CTID</i>
<tr valign="top" align="left">
+
[<b>--wait</b>] [<b>--force</b>] [<b>--fast</b>]
<td width="11%"></td>
+
[<b>--skip-fsck</b>]</p>
<td width="4%">
 
  
<p>50</p></td>
+
<p style="margin-left:17%;">Restarts a container, i.e.
<td width="7%"></td>
+
stops it if it is running, and starts again. Accepts all the
<td width="78%">
+
<b>start</b> and <b>stop</b> options.</p>
  
<p>Unable to mount container</p></td></tr>
+
<p style="margin-left:17%; margin-top: 1em">Note that this
<tr valign="top" align="left">
+
command can lead to execution of some action scripts (see
<td width="11%"></td>
+
<b>ACTION SCRIPTS</b> below).</p>
<td width="4%">
 
  
<p>51</p></td>
+
<p style="margin-left:11%;"><b>status</b> <i>CTID</i></p>
<td width="7%"></td>
 
<td width="78%">
 
  
<p>Unable to unmount container</p></td></tr>
+
<p style="margin-left:17%;">Shows a container status. This
<tr valign="top" align="left">
+
is a line with five or six words, separated by spaces.</p>
<td width="11%"></td>
 
<td width="4%">
 
  
<p>52</p></td>
+
<p style="margin-left:17%; margin-top: 1em">First word is
<td width="7%"></td>
+
literally <b>CTID</b>.</p>
<td width="78%">
 
  
<p>Unable to delete a container</p></td></tr>
+
<p style="margin-left:17%; margin-top: 1em">Second word is
<tr valign="top" align="left">
+
the numeric <i>CT ID</i>.</p>
<td width="11%"></td>
 
<td width="4%">
 
  
<p>53</p></td>
+
<p style="margin-left:17%; margin-top: 1em">Third word is
<td width="7%"></td>
+
showing whether this container exists or not, it can be
<td width="78%">
+
either <b>exist</b> or <b>deleted</b>.</p>
  
<p>Container private area not exist</p></td></tr>
+
<p style="margin-left:17%; margin-top: 1em">Fourth word is
<tr valign="top" align="left">
+
showing the status of the container filesystem, it can be
<td width="11%"></td>
+
either <b>mounted</b> or <b>unmounted</b>.</p>
<td width="4%">
 
  
<p>60</p></td>
+
<p style="margin-left:17%; margin-top: 1em">Fifth word
<td width="7%"></td>
+
shows if the container is running, it can be either
<td width="78%">
+
<b>running</b> or <b>down</b>.</p>
  
<p><b>vzquota on</b> failed</p></td></tr>
+
<p style="margin-left:17%; margin-top: 1em">Sixth word, if
<tr valign="top" align="left">
+
exists, is <b>suspended</b>. It appears if a dump file
<td width="11%"></td>
+
exists for a stopped container (see <b>suspend</b>).</p>
<td width="4%">
 
  
<p>61</p></td>
+
<p style="margin-left:17%; margin-top: 1em">This command
<td width="7%"></td>
+
can also be usable from scripts.</p>
<td width="78%">
 
  
<p><b>vzquota init</b> failed</p></td></tr>
+
<p style="margin-left:11%;"><b>mount</b> <i>CTID</i></p>
<tr valign="top" align="left">
 
<td width="11%"></td>
 
<td width="4%">
 
  
<p>62</p></td>
+
<p style="margin-left:17%;">Mounts container private area.
<td width="7%"></td>
+
Note that this command can lead to execution of
<td width="78%">
+
<b>premount</b> and <b>mount</b> action scripts (see
 +
<b>ACTION SCRIPTS</b> below).</p>
  
<p><b>vzquota setlimit</b> failed</p></td></tr>
+
<p style="margin-left:11%;"><b>umount</b> <i>CTID</i></p>
<tr valign="top" align="left">
 
<td width="11%"></td>
 
<td width="4%">
 
  
<p>63</p></td>
+
<p style="margin-left:17%;">Unmounts container private
<td width="7%"></td>
+
area. Note that this command can lead to execution of
<td width="78%">
+
<b>umount</b> and <b>postumount</b> action scripts (see
 +
<b>ACTION SCRIPTS</b> below).</p>
  
<p>Parameter <b>DISKSPACE</b> not set</p></td></tr>
+
<p style="margin-left:17%; margin-top: 1em">Note that
<tr valign="top" align="left">
+
<b>stop</b> does <b>umount</b> automatically.</p>
<td width="11%"></td>
 
<td width="4%">
 
  
<p>64</p></td>
+
<p style="margin-left:11%;"><b>convert</b> <i>CTID</i>
<td width="7%"></td>
+
[<b>--layout
<td width="78%">
+
ploop</b>[<b>:</b>{<b>expanded</b>|<b>plain</b>|<b>raw</b>}]]</p>
  
<p>Parameter <b>DISKINODES</b> not set</p></td></tr>
+
<p style="margin-left:17%;">Convert CT private area to
<tr valign="top" align="left">
+
reside on a ploop device (available in kernel version
<td width="11%"></td>
+
042stab052.8 and greater). Conversion should be performed
<td width="4%">
+
when a container is stopped, plus disk space quota should be
 +
set.</p>
  
<p>66</p></td>
+
<p style="margin-left:11%;"><b>compact</b> <i>CTID</i></p>
<td width="7%"></td>
 
<td width="78%">
 
  
<p><b>vzquota off</b> failed</p></td></tr>
+
<p style="margin-left:17%;">Compact container image. This
<tr valign="top" align="left">
+
only makes sense for ploop layout.</p>
<td width="11%"></td>
 
<td width="4%">
 
  
<p>67</p></td>
+
<p style="margin-left:11%;"><b>quotaon</b> <i>CTID</i></p>
<td width="7%"></td>
 
<td width="78%">
 
  
<p>ugid quota not initialized</p></td></tr>
+
<p style="margin-left:17%;">Turn disk quota on. Not that
<tr valign="top" align="left">
+
<b>mount</b> and <b>start</b> does that automatically.</p>
<td width="11%"></td>
 
<td width="4%">
 
  
<p>71</p></td>
+
<p style="margin-left:11%;"><b>quotaoff</b> <i>CTID</i></p>
<td width="7%"></td>
 
<td width="78%">
 
  
<p>Incorrect IP address format</p></td></tr>
+
<p style="margin-left:17%;">Turn disk quota off. Not that
<tr valign="top" align="left">
+
<b>umount</b> and <b>stop</b> does that automatically.</p>
<td width="11%"></td>
 
<td width="4%">
 
  
<p>74</p></td>
+
<p style="margin-left:11%;"><b>quotainit</b>
<td width="7%"></td>
+
<i>CTID</i></p>
<td width="78%">
 
  
<p>Error changing password</p></td></tr>
+
<p style="margin-left:17%;">Initialize disk quota (i.e. run
<tr valign="top" align="left">
+
<b>vzquota init</b>) with the parameters taken from the CT
<td width="11%"></td>
+
configuration file [[Man/ctid.conf.5|<b>ctid.conf</b>(5)]].</p>
<td width="4%">
 
  
<p>78</p></td>
+
<p style="margin-left:11%;"><b>exec</b> <i>CTID
<td width="7%"></td>
+
command</i></p>
<td width="78%">
 
  
<p>IP address already in use</p></td></tr>
+
<p style="margin-left:17%;">Executes <i>command</i> in a
<tr valign="top" align="left">
+
container. Environment variables are not set inside the
<td width="11%"></td>
+
container. Signal handlers may differ from default settings.
<td width="4%">
+
If <i>command</i> is <b>-</b>, commands are read from
 +
stdin.</p>
  
<p>79</p></td>
+
<p style="margin-left:11%;"><b>exec2</b> <i>CTID
<td width="7%"></td>
+
command</i></p>
<td width="78%">
 
  
<p>Container action script returned an error</p></td></tr>
+
<p style="margin-left:17%;">The same as <b>exec</b>, but
<tr valign="top" align="left">
+
return code is that of <i>command</i>.</p>
<td width="11%"></td>
 
<td width="4%">
 
  
<p>82</p></td>
+
<p style="margin-left:11%;"><b>runscript</b> <i>CTID
<td width="7%"></td>
+
script</i></p>
<td width="78%">
 
  
<p>Config file copying error</p></td></tr>
+
<p style="margin-left:17%;">Run specified shell script in
<tr valign="top" align="left">
+
the container. Argument <i>script</i> is a file on the host
<td width="11%"></td>
+
system which contents is read by vzctl and executed in the
<td width="4%">
+
context of the container. For a running container, the
 +
command jumps into the container and executes the script.
 +
For a stopped container, it enters the container, mounts
 +
container&rsquo;s root filesystem, executes the script, and
 +
unmounts CT root. In the latter case, the container is not
 +
really started, no file systems other than root (such as
 +
<b>/proc</b>) are mounted, no startup scripts are executed
 +
etc. Thus the environment in which the script is running is
 +
far from normal and is only usable for very basic
 +
operations.</p>
  
<p>86</p></td>
+
<p style="margin-left:11%;"><b>enter</b> <i>CTID</i>
<td width="7%"></td>
+
[<b>--exec</b> <i>command</i> [<i>arg</i> ...]]</p>
<td width="78%">
 
  
<p>Error setting devices (<b>--devices</b> or
+
<p style="margin-left:17%;">Enters into a container (giving
<b>--devnodes</b>)</p> </td></tr>
+
a container&rsquo;s root shell). This option is a back-door
<tr valign="top" align="left">
+
for host root only. The proper way to have CT root shell is
<td width="11%"></td>
+
to use <b>ssh</b>(1).</p>
<td width="4%">
 
  
<p>89</p></td>
+
<p style="margin-left:17%; margin-top: 1em">Option
<td width="7%"></td>
+
<b>--exec</b> is used to run <i>command</i> with arguments
<td width="78%">
+
after entering into container. This is useful if command to
 +
be run requires a terminal (so <b>vzctl exec</b> can not be
 +
used) and for some reason you can not use <b>ssh</b>(1).</p>
 +
 
 +
<p style="margin-left:17%; margin-top: 1em">You need to log
 +
out manually from the shell to finish session (even if you
 +
specified <b>--exec</b>).</p>
  
<p>IP address not available</p></td></tr>
+
<p style="margin-left:11%;"><b>console</b> <i>CTID</i>
<tr valign="top" align="left">
+
[<i>ttynum</i>]</p>
<td width="11%"></td>
 
<td width="4%">
 
  
<p>91</p></td>
+
<p style="margin-left:17%;">Attach to a container console.
<td width="7%"></td>
+
Optional <i>ttynum</i> argument is tty number (such as
<td width="78%">
+
<b>4</b> for <b>tty4</b>), default is <b>1</b> which is used
 +
for container&rsquo;s <b>/dev/console</b>.</p>
  
<p>OS template not found</p></td></tr>
+
<p style="margin-left:17%; margin-top: 1em">Note the
<tr valign="top" align="left">
+
consoles are persistent, meaning that: <br>
<td width="11%"></td>
+
&bull; it can be attached to even if the container is not
<td width="4%">
+
running; <br>
 +
&bull; there is no automatic detachment upon the container
 +
stop; <br>
 +
&bull; detaching from the console leaves anything running in
 +
this console as is.</p>
  
<p>100</p></td>
+
<p style="margin-left:17%; margin-top: 1em">The following
<td width="7%"></td>
+
escape sequences are recognized by <b>vzctl console</b>.
<td width="78%">
+
Note that these sequences are only recognized at the
 +
beginning of a line.</p>
  
<p>Unable to find container IP address</p></td></tr>
+
<p style="margin-left:17%; margin-top: 1em">&bull;
<tr valign="top" align="left">
+
<b>Esc</b> then <b>.</b> to detach from the console.</p>
<td width="11%"></td>
 
<td width="4%">
 
  
<p>104</p></td>
+
<p style="margin-left:17%; margin-top: 1em">&bull;
<td width="7%"></td>
+
<b>Esc</b> then <b>!</b> to kill anything running on the
<td width="78%">
+
console (SAK). This is helpful when one expects a login
 +
prompt but there isn&rsquo;t one.</p>
  
<p><b>VE_NETDEV</b> ioctl error</p></td></tr>
+
=== Other options ===
<tr valign="top" align="left">
 
<td width="11%"></td>
 
<td width="4%">
 
  
<p>105</p></td>
+
<p style="margin-left:11%;"><b>--help</b></p>
<td width="7%"></td>
 
<td width="78%">
 
  
<p>Container start disabled</p></td></tr>
+
<p style="margin-left:17%;">Prints help message with a
<tr valign="top" align="left">
+
brief list of possible options.</p>
<td width="11%"></td>
 
<td width="4%">
 
  
<p>106</p></td>
+
<p style="margin-left:11%;"><b>--version</b></p>
<td width="7%"></td>
 
<td width="78%">
 
  
<p>Unable to set iptables on a running container</p></td></tr>
+
<p style="margin-left:17%;">Prints <b>vzctl</b>
<tr valign="top" align="left">
+
version.</p>
<td width="11%"></td>
 
<td width="4%">
 
  
<p>107</p></td>
+
== ACTION SCRIPTS ==
<td width="7%"></td>
 
<td width="78%">
 
  
<p>Distribution-specific configuration file not found</p></td></tr>
+
<p style="margin-left:11%; margin-top: 1em"><b>vzctl</b>
<tr valign="top" align="left">
+
has an ability to execute user-defined scripts when a
<td width="11%"></td>
+
specific <b>vzctl</b> command is run for a container. The
<td width="4%">
+
following <b>vzctl</b> commands can trigger execution of
 +
action scripts: <b>start</b>, <b>stop</b>, <b>restart</b>,
 +
<b>mount</b> and <b>umount</b>.</p>
  
<p>109</p></td>
+
<p style="margin-left:11%; margin-top: 1em">Action scripts
<td width="7%"></td>
+
are located in the <b>/etc/vz/conf/</b> directory. There are
<td width="78%">
+
global and per-CT scripts. Global scripts have a literal
 +
prefix of <b>vps.</b> and are executed for all containers.
 +
Per-CT scripts have a <i>CTID</i><b>.</b> numeric prefix and
 +
are executed for the given container only.</p>
  
<p>Unable to apply a config</p></td></tr>
+
<p style="margin-left:11%; margin-top: 1em">Please note
<tr valign="top" align="left">
+
scripts are executed in a host system (CT0) context, with
<td width="11%"></td>
+
the exception of <b>.start</b> and <b>.stop</b> scripts,
<td width="4%">
+
which are executed in a container context.</p>
  
<p>129</p></td>
+
<p style="margin-left:11%; margin-top: 1em">The following
<td width="7%"></td>
+
action scripts are currently defined: <b><br>
<td width="78%">
+
vps.premount</b>, <i>CTID</i><b>.premount</b></p>
 +
 
 +
<p style="margin-left:22%;">Global and per-CT mount scripts
 +
which are executed for a container before it is mounted.
 +
Scripts are executed in the host system context, while a CT
 +
is not yet mounted or running. Global script, if exists, is
 +
executed first.</p>
  
<p>Unable to set meminfo parameter</p></td></tr>
+
<p style="margin-left:11%;"><b>vps.mount</b>,
<tr valign="top" align="left">
+
<i>CTID</i><b>.mount</b></p>
<td width="11%"></td>
 
<td width="4%">
 
  
<p>130</p></td>
+
<p style="margin-left:22%;">Global and per-CT mount scripts
<td width="7%"></td>
+
which are executed for a container right after it is
<td width="78%">
+
mounted. Otherwise they are the same as <b>.premount</b>
 +
scripts.</p>
  
<p>Error setting veth interface</p></td></tr>
+
<p style="margin-left:11%;"><i>CTID</i><b>.start</b></p>
<tr valign="top" align="left">
 
<td width="11%"></td>
 
<td width="4%">
 
  
<p>131</p></td>
+
<p style="margin-left:22%;">Right after <b>vzctl</b> has
<td width="7%"></td>
+
started a container, it executes this script in a container
<td width="78%">
+
context.</p>
  
<p>Error setting container name</p></td></tr>
+
<p style="margin-left:11%;"><i>CTID</i><b>.stop</b></p>
<tr valign="top" align="left">
 
<td width="11%"></td>
 
<td width="4%">
 
  
<p>133</p></td>
+
<p style="margin-left:22%;">Right before <b>vzctl</b> has
<td width="7%"></td>
+
stopped a container, it executes this script in a container
<td width="78%">
+
context.</p>
  
<p>Waiting for container start failed</p></td></tr>
+
<p style="margin-left:11%;"><b>vps.umount</b>,
<tr valign="top" align="left">
+
<i>CTID</i><b>.umount</b></p>
<td width="11%"></td>
 
<td width="4%">
 
  
<p>139</p></td>
+
<p style="margin-left:22%;">Global and per-CT umount
<td width="7%"></td>
+
scripts which are executed for a container before it is
<td width="78%">
+
unmounted. Scripts are executed in the host system context,
 +
while a CT is mounted. Global script, if exists, is executed
 +
first.</p>
  
<p>Error saving container configuration file</p></td></tr>
+
<p style="margin-left:11%;"><b>vps.postumount</b>,
<tr valign="top" align="left">
+
<i>CTID</i><b>.postumount</b></p>
<td width="11%"></td>
 
<td width="4%">
 
  
<p>148</p></td>
+
<p style="margin-left:22%;">Global and per-CT umount
<td width="7%"></td>
+
scripts which are executed for a container right after it is
<td width="78%">
+
unmounted. Otherwise they are the same as <b>.umount</b>
 +
scripts.</p>
  
<p>Error setting container IO parameters (ioprio)</p></td></tr>
+
<p style="margin-left:11%; margin-top: 1em">The environment
</table>
+
passed to all the <b>*mount</b> scripts is the standard
 +
environment of the parent (i.e. <b>vzctl</b>) with two
 +
additional variables: <b>$VEID</b> and <b>$VE_CONFFILE</b>.
 +
The first one holds the ID of the container, and the second
 +
one holds the full path to the container configuration file.
 +
If the script needs to get other CT configuration
 +
parameters, such as <b>$VE_ROOT</b>, it needs to get those
 +
from global and per-CT configuration files.</p>
  
== EXAMPLES ==
+
<p style="margin-left:11%; margin-top: 1em">Here is an
 
+
example of a mount script, which makes host system&rsquo;s
<p style="margin-left:11%; margin-top: 1em">To create and
+
/mnt/disk available to container(s). Script name can either
start &quot;basic&quot; container with ID of 1000 using
+
be <b>/etc/vz/conf/vps.mount</b> or
<i>fedora-core-5</i> OS template and IP address of
+
<b>/etc/vz/conf/</b><i>CTID</i><b>.mount</b>.</p>
192.168.10.200: <br>
+
 
vzctl create 1000 --ostemplate fedora-core-5 --config basic
+
<pre style="margin-left:11%; margin-top: 1em">  # If one of these files does not exist then something
<br>
+
  # is really broken
vzctl set 1000 --ipadd 192.168.10.200 --save <br>
+
  [ -f /etc/vz/vz.conf ] || exit 1
vzctl start 1000</p>
+
  [ -f $VE_CONFFILE ] || exit 1
 +
  # Source both files. Note the order is important.
 +
  . /etc/vz/vz.conf
 +
  . $VE_CONFFILE
 +
  SRC=/mnt/disk
 +
  DST=/mnt/disk
 +
  mount -n -t simfs $SRC ${VE_ROOT}${DST} -o $SRC</pre>
 +
 
 +
== EXIT STATUS ==
 +
 
 +
<p style="margin-left:11%; margin-top: 1em">Returns 0 upon
 +
success, or an appropriate error code in case of an
 +
error:</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="4%">
 +
 
 +
<p>1</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
  
<p style="margin-left:11%; margin-top: 1em">To set number
+
<p>Failed to set a UBC parameter</p></td></tr>
of processes barrier/limit to 80/100, and PTY barrier/limit
+
<tr valign="top" align="left">
to 16/20 PTYs: <br>
+
<td width="11%"></td>
vzctl set 1000 --numproc 80:100 -t 16:20 --save</p>
+
<td width="4%">
 +
 
 +
<p>2</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Failed to set a fair scheduler parameter</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>3</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Generic system error</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>5</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>The running kernel is not an OpenVZ kernel (or some
 +
OpenVZ modules are not loaded)</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>6</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Not enough system resources</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>7</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p><b>ENV_CREATE</b> ioctl failed</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>8</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Command executed by <b>vzctl exec</b> returned non-zero
 +
exit code</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>9</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Container is locked by another <b>vzctl</b>
 +
invocation</p> </td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>10</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Global OpenVZ configuration file [[Man/vz.conf.5|<b>vz.conf</b>(5)]] not
 +
found</p> </td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>11</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>A vzctl helper script file not found</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>12</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Permission denied</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>13</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Capability setting failed</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>14</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Container configuration file [[Man/ctid.conf.5|<b>ctid.conf</b>(5)]] not
 +
found</p> </td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>15</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Timeout on <b>vzctl exec</b></p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>16</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Error during <b>vzctl suspend</b></p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>17</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Error during <b>vzctl resume</b></p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>18</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Error from <b>setluid()</b> syscall</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>20</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Invalid command line parameter</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>21</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Invalid value for command line parameter</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>22</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Container root directory (<b>VE_ROOT</b>) not set</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>23</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Container private directory (<b>VE_PRIVATE</b>) not
 +
set</p> </td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>24</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Container template directory (<b>TEMPLATE</b>) not
 +
set</p> </td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>28</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Not all required UBC parameters are set, unable to start
 +
container</p> </td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>29</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>OS template is not specified, unable to create
 +
container</p> </td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>31</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Container not running</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>32</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Container already running</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>33</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Unable to stop container</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>34</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Unable to add IP address to container</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>40</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Container not mounted</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>41</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Container already mounted</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>43</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Container private area not found</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>44</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Container private area already exists</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>46</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Not enough disk space</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>47</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Bad/broken container (<b>/sbin/init</b> or
 +
<b>/bin/sh</b> not found)</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>48</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Unable to create a new container private area</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>49</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Unable to create a new container root area</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>50</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Unable to mount container</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>51</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Unable to unmount container</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>52</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Unable to delete a container</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>53</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Container private area not exist</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>60</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p><b>vzquota on</b> failed</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>61</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p><b>vzquota init</b> failed</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>62</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p><b>vzquota setlimit</b> failed</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>63</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Parameter <b>DISKSPACE</b> not set</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>64</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Parameter <b>DISKINODES</b> not set</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>65</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Error setting in-container disk quotas</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>66</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p><b>vzquota off</b> failed</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>67</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>ugid quota not initialized</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>71</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Incorrect IP address format</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>74</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Error changing password</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>78</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>IP address already in use</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>79</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Container action script returned an error</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>82</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Config file copying error</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>86</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Error setting devices (<b>--devices</b> or
 +
<b>--devnodes</b>)</p> </td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>89</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>IP address not available</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>91</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>OS template not found</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>99</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Ploop is not supported by either the running kernel or
 +
vzctl.</p> </td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>100</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Unable to find container IP address</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>104</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p><b>VE_NETDEV</b> ioctl error</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>105</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Container start disabled</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>106</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Unable to set iptables on a running container</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>107</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Distribution-specific configuration file not found</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>109</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Unable to apply a config</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>129</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Unable to set meminfo parameter</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>130</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Error setting veth interface</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>131</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Error setting container name</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>133</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Waiting for container start failed</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>139</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Error saving container configuration file</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>148</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Error setting container IO parameters (ioprio)</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>150</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Ploop image file not found</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>151</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Error creating ploop image</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>152</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Error mounting ploop image</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>153</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Error unmounting ploop image</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>154</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Error resizing ploop image</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>155</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Error converting container to ploop layout</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>156</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Error creating ploop snapshot</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>157</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Error merging ploop snapshot</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>158</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Error deleting ploop snapshot</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>159</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Error switching ploop snapshot</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>166</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Error compacting ploop image</p></td></tr>
 +
<tr valign="top" align="left">
 +
<td width="11%"></td>
 +
<td width="4%">
 +
 
 +
<p>167</p></td>
 +
<td width="7%"></td>
 +
<td width="78%">
 +
 
 +
<p>Error listing ploop snapsots</p></td></tr>
 +
</table>
 +
 
 +
== EXAMPLES ==
 +
 
 +
<p style="margin-left:11%; margin-top: 1em">To create and
 +
start &quot;basic&quot; container with ID of 1000 using
 +
<b>centos-5</b> OS template and IP address of
 +
192.168.10.200:</p>
 +
 
 +
<pre style="margin-left:11%; margin-top: 1em">  vzctl create 1000 --ostemplate centos-5 --config basic
 +
  vzctl set 1000 --ipadd 192.168.10.200 --save
 +
  vzctl start 1000</pre>
 +
 
 +
<p style="margin-left:11%; margin-top: 1em">To set number
 +
of processes barrier/limit to 80/100, and PTY barrier/limit
 +
to 16/20 PTYs:</p>
 +
 
 +
<pre style="margin-left:11%; margin-top: 1em">  vzctl set 1000 --numproc 80:100 -t 16:20 --save</pre>
 +
 
 +
<p style="margin-left:11%; margin-top: 1em">To execute
 +
command <b>ls -la</b> in this container:</p>
 +
 
 +
<pre style="margin-left:11%; margin-top: 1em">  vzctl exec 1000 /bin/ls -la</pre>
  
 
<p style="margin-left:11%; margin-top: 1em">To execute
 
<p style="margin-left:11%; margin-top: 1em">To execute
command <b>ls -la</b> in this container: <br>
+
command pipe <b>ls -l / | sort</b> in this container:</p>
vzctl exec 1000 /bin/ls -la</p>
+
 
 
+
<pre style="margin-left:11%; margin-top: 1em">   vzctl exec 1000 &rsquo;ls -l / | sort&rsquo;</pre>
<p style="margin-left:11%; margin-top: 1em">To execute
+
 
command pipe <b>ls -l / | sort</b> in this container: <br>
+
<p style="margin-left:11%; margin-top: 1em">To enter this
vzctl exec 1000 &rsquo;ls -l / | sort&rsquo;</p>
+
container and execute command <b>apt-get install
 
+
vim</b>:</p>
<p style="margin-left:11%; margin-top: 1em">To enter this
+
 
container and execute command <b>apt-get install vim</b>:
+
<pre style="margin-left:11%; margin-top: 1em">   vzctl enter 1000 --exec apt-get install vim</pre>
<br>
+
 
vzctl enter 1000 --exec apt-get install vim</p>
+
<p style="margin-left:11%; margin-top: 1em">Note that in
 
+
the above example you will need to log out from the
<p style="margin-left:11%; margin-top: 1em">Note that in
+
container&rsquo;s shell after apt-get finishes.</p>
the above example you will need to log out from the
+
 
container&rsquo;s shell after apt-get finishes.</p>
+
<p style="margin-left:11%; margin-top: 1em">To enter this
 
+
container, execute command <b>apt-get install vim</b> and
<p style="margin-left:11%; margin-top: 1em">To enter this
+
logout after successful installation (or stay inside the
container, execute command <b>apt-get install vim</b> and
+
container if installation process failed) use
logout after successful installation (or stay inside the
+
<b>&amp;&amp;</b>:</p>
container if installation process failed) use
+
 
<b>&amp;&amp;</b>: <br>
+
<pre style="margin-left:11%; margin-top: 1em">  vzctl enter 1000 --exec &quot;apt-get install vim &amp;&amp; logout&quot;</pre>
vzctl enter 1000 --exec &quot;apt-get install vim &amp;&amp;
+
 
logout&quot;</p>
+
<p style="margin-left:11%; margin-top: 1em">To enter this
 
+
container, execute command <b>apt-get install vim</b> and
<p style="margin-left:11%; margin-top: 1em">To enter this
+
logout independently of exit code of installation process
container, execute command <b>apt-get install vim</b> and
+
use <b>;</b>:</p>
logout independently of exit code of installation process
+
 
use <b>;</b>: <br>
+
<pre style="margin-left:11%; margin-top: 1em">  vzctl enter 1000 --exec &quot;apt-get install vim ; logout&quot;</pre>
vzctl enter 1000 --exec &quot;apt-get install vim ;
+
 
logout&quot;</p>
+
<p style="margin-left:11%; margin-top: 1em">Note that you
 
+
need to quote the command if you use <b>&amp;&amp;</b> or
<p style="margin-left:11%; margin-top: 1em">Note that you
+
<b>;</b>.</p>
need to quote the command if you use <b>&amp;&amp;</b> or
+
 
<b>;</b>.</p>
+
<p style="margin-left:11%; margin-top: 1em">To stop this
 
+
container:</p>
<p style="margin-left:11%; margin-top: 1em">To stop this
+
 
container: <br>
+
<pre style="margin-left:11%; margin-top: 1em">  vzctl stop 1000</pre>
vzctl stop 1000</p>
+
 
 +
<p style="margin-left:11%; margin-top: 1em">To permanently
 +
remove this container:</p>
  
<p style="margin-left:11%; margin-top: 1em">To permanently
+
<pre style="margin-left:11%; margin-top: 1em">   vzctl destroy 1000</pre>
remove this container: <br>
 
vzctl destroy 1000</p>
 
  
 
== FILES ==
 
== FILES ==
  
<p style="margin-left:11%; margin-top: 1em">/etc/vz/vz.conf
+
<pre style="margin-left:11%; margin-top: 1em">/etc/vz/vz.conf
<br>
+
/etc/vz/conf/<i>CTID</i>.conf
/etc/vz/conf/<i>CTID</i>.conf <br>
+
/etc/vz/conf/vps.{premount,mount,umount,postumount}
/etc/vz/conf/vps.{premount,mount,umount,postumount} <br>
 
 
 
 
/etc/vz/conf/<i>CTID</i>.{premount,mount,start,stop,umount,postumount}
 
/etc/vz/conf/<i>CTID</i>.{premount,mount,start,stop,umount,postumount}
<br>
+
/proc/vz/veinfo
/proc/vz/veinfo <br>
+
/proc/vz/vzquota
/proc/vz/vzquota <br>
+
/proc/user_beancounters
/proc/user_beancounters <br>
+
/proc/bc/*
/proc/bc/* <br>
+
/proc/fairsched</pre>
/proc/fairsched</p>
 
  
 
== SEE ALSO ==
 
== SEE ALSO ==
Line 1,818: Line 2,796:
 
[[Man/vzifup-post.8|<b>vzifup-post</b>(8)]], [[Man/vzlist.8|<b>vzlist</b>(8)]],
 
[[Man/vzifup-post.8|<b>vzifup-post</b>(8)]], [[Man/vzlist.8|<b>vzlist</b>(8)]],
 
[[Man/vzmemcheck.8|<b>vzmemcheck</b>(8)]], [[Man/vzmigrate.8|<b>vzmigrate</b>(8)]], [[Man/vzpid.8|<b>vzpid</b>(8)]],
 
[[Man/vzmemcheck.8|<b>vzmemcheck</b>(8)]], [[Man/vzmigrate.8|<b>vzmigrate</b>(8)]], [[Man/vzpid.8|<b>vzpid</b>(8)]],
[[Man/vzquota.8|<b>vzquota</b>(8)]], [[Man/vzsplit.8|<b>vzsplit</b>(8)]],
+
[[Man/vzquota.8|<b>vzquota</b>(8)]], [[Man/vzsplit.8|<b>vzsplit</b>(8)]], [[Man/vzubc.8|<b>vzubc</b>(8)]],
 
<b>[[UBC]]</b>.</p>
 
<b>[[UBC]]</b>.</p>
  
Line 1,824: Line 2,802:
  
 
<p style="margin-left:11%; margin-top: 1em">Copyright (C)
 
<p style="margin-left:11%; margin-top: 1em">Copyright (C)
2000-2011, Parallels, Inc. Licensed under GNU GPL.</p>
+
2000-2013, Parallels, Inc. Licensed under GNU GPL.</p>

Latest revision as of 18:21, 23 April 2015

NAME

vzctl − perform various operations on an OpenVZ container

SYNOPSIS

vzctl

[flags] create CTID --parameter value [...]

vzctl

[flags] start CTID [--wait] [--force] [--skip-fsck] [--skip-remount]

vzctl

[flags] stop CTID [--fast] [--skip-umount]

vzctl

[flags] restart CTID [--wait] [--force] [--fast] [--skip-fsck] [--skip-remount]

vzctl

[flags] suspend | resume CTID [--dumpfile name]

vzctl

[flags] snapshot CTID [--id uuid] [--name name] [--description desc] [--skip-suspend] [--skip-config]

vzctl

[flags] snapshot-switch CTID [--skip-resume | --must-resume] [--skip-config] --id uuid

vzctl

[flags] snapshot-delete CTID --id uuid

vzctl

[flags] snapshot-mount CTID --id uuid --target dir

vzctl

[flags] snapshot-umount CTID --id uuid

vzctl

[flags] snapshot-list CTID [-H] [-o field[,field...] [--id uuid]

vzctl

[flags] set CTID --parameter value [...] [--save] [--force] [--setmode restart|ignore]

vzctl

[flags] set CTID --reset_ub

vzctl

[flags] destroy | delete | mount | umount | status | quotaon | quotaoff | quotainit CTID

vzctl

[flags] console CTID [ttynum]

vzctl

[flags] convert CTID [--layout ploop[:{expanded|plain|raw}]]

vzctl

[flags] compact CTID

vzctl

[flags] exec | exec2 CTID command [arg ...]

vzctl

[flags] enter CTID [--exec command [arg ...]]

vzctl

[flags] runscript CTID script

vzctl

--help | --version

DESCRIPTION

Utility vzctl runs on the host system (otherwise known as Hardware Node, or HN) and performs direct manipulations with containers (CTs).

Containers can be referred to by either numeric CTID or by name (see --name option). Note that CT ID <= 100 are reserved for OpenVZ internal purposes. A numeric ID should not be more than 2147483644.

OPTIONS

Flags

These flags come before a command, and can be used with any command. They affect logging to console (terminal) only, and do not affect logging to a log file.

--quiet

Disables output. Note that scripts run by vzctl are still able to produce some output.

--verbose

Increments logging level up from the default. Can be used multiple times. Default value is set to the value of VERBOSE parameter in the global configuration file vz.conf(5), or to 0 if not set by VERBOSE parameter.

Setting container parameters

set

CTID [--onboot yes|no] [--bootorder number] [--root path] [--private path] [--mount_opts options] [--userpasswd user:pass] [--disabled yes|no] [--name name] [--description string] [--ostemplate string] [--stop-timeout seconds] [--ipadd addr] [--ipdel addr|all] [--hostname name] [--nameserver addr] [--searchdomain name] [--netif_add dev[,params...]] [--netif_del dev|all] [--ifname dev [--mac hwaddr] [--host_ifname dev] [--host_mac hwaddr] [--bridge name] [--mac_filter on|off]] [--numproc items] [--numtcpsock items] [--numothersock items] [--vmguarpages pages] [--kmemsize bytes] [--tcpsndbuf bytes] [--tcprcvbuf bytes] [--othersockbuf bytes] [--dgramrcvbuf bytes] [--oomguarpages pages] [--lockedpages pages] [--privvmpages pages] [--shmpages pages] [--numfile items] [--numflock items] [--numpty items] [--numsiginfo items] [--dcachesize bytes] [--numiptent num] [--physpages pages] [--swappages pages] [--ram bytes] [--swap bytes] [--vm_overcommit float] [--cpuunits num] [--cpulimit num] [--cpus num] [--cpumask cpus|auto|all] [--nodemask nodes|all] [--meminfo none|mode:value] [--iptables name[,...]] [--netfilter disabled|stateless|stateful|full] [--netdev_add ifname] [--netdev_del ifname] [--diskquota yes|no] [--diskspace num] [--diskinodes num] [--quotatime seconds] [--quotaugidlimit num] [--capability capname:on|off[,...]] [--devnodes param] [--devices param] [--pci_add dev] [--pci_del dev] [--features name:on|off[,...]] [--applyconfig name] [--applyconfig_map group] [--ioprio num] [--iolimit mbps] [--iopslimit iops] [--save] [--force] [--reset_ub] [--setmode restart|ignore]

This command sets various container parameters. If the container is currently running, vzctl applies these parameters to the container. The following options can be used with set command.

Flags

--save

If this flag is given, parameters are saved in container configuration file ctid.conf(5).

--force

If this flag is given together with --save, parameters are saved even if the current kernel doesn’t support OpenVZ. Note this flag does not make sense without --save, so --save is required.

--reset_ub

If this flag is given, vzctl applies all User Beancounter parameters from the configuration file to a running container. This is helpful in case configuration file is modified manually. Please note this flag is exclusive, i.e. it can not be combined with any other options or flags.

--setmode restart | ignore

A few parameters can only be applied by restarting the container. By default, vzctl prints a warning if such parameters are supplied and a container is running. Use --setmode restart together with --save flag to restart a container in such a case, or --setmode ignore to suppress the warning.

Miscellaneous

--onboot yes | no

Sets whether the container will be started during system boot. The container will be started on boot by vz initscript if either this parameter is set to yes, or the container was running just before last reboot, and this parameter is not set to no. Default value is unset, meaning the container will be started if it was running before the last reboot.

--bootorder number

Sets the boot order priority for this CT. The higher the number is, the earlier in the boot process this container starts. By default this parameter is unset, which is considered to be the lowest priority, so containers with unset bootorder will start last.

--root path

Sets the path to root directory (VE_ROOT) for this container. This is essentially a mount point for container’s root directory. Argument can contain literal string $VEID, which will be substituted with the numeric CT ID.

--private path

Sets the path to private directory (VE_PRIVATE) for this container. This is a directory in which all the container’s files are stored. Argument can contain literal string $VEID, which will be substituted with the numeric CT ID.

--mount_opts option[,option...]

Sets additional mount options for container file system. Only applicable for ploop layout, ignored otherwise.

--userpasswd user:password

Sets password for the given user in a container, creating the user if it does not exists. Note that this option is not saved in configuration file at all (so --save flag is useless), it is applied directly to the container, by running distribution-specific programs inside the container. It is not recommended to combine this option with any other options.

In case container was not running, it is automatically started then all the appropriate changes are applied, then it is stopped.

Note that container should be created before using this option.

--disabled yes | no

Disable container start. To force the start of a disabled container, use vzctl start --force.

--name name

Add a name for a container. The name can later be used in subsequent calls to vzctl in place of CTID. Note this option can not be used without --save.

--description string

Add a textual description for a container.

--ostemplate string

Sets a new value of OSTEMPLATE parameter in container configuration file ctid.conf(5). Requires --save flag. Useful after a change/upgrade of a distribution running inside container, as vzctl uses the value of OSTEMPLATE to run distribution-specific scripts.

--stop-timeout seconds

Sets a time to wait for container to stop on vzctl stop before forcibly killing it, in seconds. Note this option can not be used without --save flag.

Special value of 0 means to use compiled-in default.

Networking

--ipadd addr

Adds an IP address addr to a given container. Address can optionally have a netmask specified in the CIDR notation (e.g. 10.1.2.3/25). Note that this option is incremental, so addr are added to already existing ones.

--ipdel addr | all

Removes IP address addr from a container. If you want to remove all the addresses, use --ipdel all.

--hostname name

Sets container hostname. vzctl writes it to the appropriate file inside a container (distribution-dependent).

--nameserver addr

Sets DNS server IP address for a container. If you want to set several nameservers, you should do it at once, so use --nameserver option multiple times in one call to vzctl, as all the name server values set in previous calls to vzctl are overwritten.

A special value of inherit can be used to auto-propagate nameserver value(s) from the host system’s /etc/resolv.conf file.

--searchdomain name

Sets DNS search domains for a container. If you want to set several search domains, you should do it at once, so use --searchdomain option multiple times in one call to vzctl, as all the search domain values set in previous calls to vzctl are overwritten.

A special value of inherit can be used to auto-propagate search domain value(s) from the host system’s /etc/resolv.conf file.

--netif_add ifname[,mac,host_ifname,host_mac,bridge]

Adds a virtual Ethernet device (veth) to a given container. Here ifname is the Ethernet device name in the container, mac is its MAC address, host_ifname is the Ethernet device name on the host, and host_mac is its MAC address. MAC addresses should be in the format like XX:XX:XX:XX:XX:XX. bridge is an optional parameter which can be used in custom network start scripts to automatically add the interface to a bridge. All parameters except ifname are optional and are automatically generated if not specified.

--netif_del dev_name | all

Removes virtual Ethernet device from a container. If you want to remove all devices, use all.

veth interface configuration

The following options can be used to reconfigure the already-created virtual Ethernet interface. To select the interface to configure, use --ifname name option.
--mac
XX:XX:XX:XX:XX:XX

MAC address of interface inside a container.

--host_ifname name

interface name for virtual interface in the host system.

--host_mac XX:XX:XX:XX:XX:XX

MAC address of interface in the host system.

If you want an independent communication with the Container through the bridge, you should specify a multicast MAC address here (FE:FF:FF:FF:FF:FF).

--bridge name

Bridge name. Custom network start scripts can use this value to automatically add the interface to a bridge.

--mac_filter on | off

Enables/disables MAC address filtering for the Container veth device and the possibility of configuring the MAC address of this device from inside the Container. If the filtering is turned on:
• the veth device accepts only those packets that have a MAC address in their headers corresponding to that of this device (excluding all broadcast and multicast packets);
• it is impossible to modify the veth MAC address from inside the Container.

By default, this functionality is enabled for all veth devices existing inside the Container.

VSwap limits

The following options sets memory and swap limits for VSwap-enabled kernels (kernel version 042stab042 or greater).

Argument is in bytes, unless otherwise specified by an optional suffix. Available suffixes are:

T, t - terabytes;
G, g - gigabytes;
M, m - megabytes;
K, k - kilobytes;
P, p - memory pages (arch-specific, usually 4KB);
B, b - bytes (this is the default).
--ram
bytes

Sets physical memory (RAM) available to a container. Actually, the option is a shortcut for setting --physpages limit (the barrier is set to 0).

--swap bytes

Set swap space available to a container. Actually, the option is a shortcut for setting --swappages limit (the barrier is set to 0).

--vm_overcommit float

Set VM overcommitment value to float. If set, it is used to calculate privmmpages parameter in case it is not set explicitly (see below). Default value is 0, meaning unlimited privvmpages.

vzctl checks if running kernel is VSwap capable, and refuses to use these parameters otherwise. This behavior can be overriden by using --force flag before parameters.

In VSwap mode, all beancounters other than RAM and swap become optional. Note though that if some optional beancounters are not set, they are calculated and set by vzctl implicitly, using the following formulae:

• lockedpages.barrier = oomguarpages.barrier = ram

• lockedpages.limit = oomguarpages.limit = unlimited

• vmguarpages.barrier = vmguarpages.limit = ram + swap

• privvmpages.barrier = privvmpages.limit = (ram + swap) * vm_overcommit

(if vm_overcommit is 0 or not set, privvmpages is set to "unlimited")

Here is an example of setting container 777 to have 512 megabytes of RAM and 1 gigabyte of swap:

   vzctl set 777 --ram 512M --swap 1G --save

User Beancounter limits

The following options sets barrier and limit for various user beancounters.

Note that for VSwap-enabled kernels (version 042stab042 or greater) these limits are optional, you must only set --ram and --swap (see above). For older kernels, these limits are obligatory.

Each option requires one or two arguments. In case of one argument, vzctl sets barrier and limit to the same value. In case of two colon-separated arguments, the first is a barrier, and the second is a limit. Each argument is either a number, a number with a suffix, or a special value unlimited.

Arguments are in items, pages or bytes. Note that page size is architecture-specific, it is 4096 bytes on x86 and x86_64 platforms.

You can also specify different suffixes for User Beancounter parameters (except for those which names start with num). For example, vzctl set CTID --privvmpages 5M:6M should set privvmpages’ barrier to 5 megabytes and its limit to 6 megabytes.

Available suffixes are:

T, t - terabytes;
G, g - gigabytes;
M, m - megabytes;
K, k - kilobytes;
P, p - memory pages (arch-specific, usually 4KB);
B, b - bytes.

You can also specify the literal word unlimited in place of a number. In that case the corresponding value will be set to LONG_MAX, i. e. the maximum possible value.
--numproc
items[:items]

Maximum number of processes and kernel-level threads. Setting the barrier and the limit to different values does not make practical sense.

--numtcpsock items[:items]

Maximum number of TCP sockets. This parameter limits the number of TCP connections and, thus, the number of clients the server application can handle in parallel. Setting the barrier and the limit to different values does not make practical sense.

--numothersock items[:items]

Maximum number of non-TCP sockets (local sockets, UDP and other types of sockets). Setting the barrier and the limit to different values does not make practical sense.

--vmguarpages pages[:pages]

Memory allocation guarantee. This parameter controls how much memory is available to a container. The barrier is the amount of memory that container’s applications are guaranteed to be able to allocate. The meaning of the limit is currently unspecified; it should be set to unlimited.

--kmemsize bytes[:bytes]

Maximum amount of kernel memory used. This parameter is related to --numproc. Each process consumes certain amount of kernel memory - 16 KB at least, 30-50 KB typically. Very large processes may consume a bit more. It is important to have a certain safety gap between the barrier and the limit of this parameter: equal barrier and limit may lead to the situation where the kernel will need to kill container’s applications to keep the kmemsize usage under the limit.

--tcpsndbuf bytes[:bytes]

Maximum size of TCP send buffers. Barrier should be not less than 64 KB, and difference between barrier and limit should be equal to or more than value of numtcpsock multiplied by 2.5 KB.

--tcprcvbuf bytes[:bytes]

Maximum size of TCP receive buffers. Barrier should be not less than 64 KB, and difference between barrier and limit should be equal to or more than value of numtcpsock multiplied by 2.5 KB.

--othersockbuf bytes[:bytes]

Maximum size of other (non-TCP) socket send buffers. If container’s processes needs to send very large datagrams, the barrier should be set accordingly. Increased limit is necessary for high performance of communications through local (UNIX-domain) sockets.

--dgramrcvbuf bytes[:bytes]

Maximum size of other (non-TCP) socket receive buffers. If container’s processes needs to receive very large datagrams, the barrier should be set accordingly. The difference between the barrier and the limit is not needed.

--oomguarpages pages[:pages]

Guarantees against OOM kill. Under this beancounter the kernel accounts the total amount of memory and swap space used by the container’s processes. The barrier of this parameter is the out-of-memory guarantee. If the oomguarpages usage is below the barrier, processes of this container are guaranteed not to be killed in out-of-memory situations. The meaning of limit is currently unspecified; it should be set to unlimited.

--lockedpages pages[:pages]

Maximum number of pages acquired by mlock(2).

--privvmpages pages[:pages]

Allows controlling the amount of memory allocated by the applications. For shared (mapped as MAP_SHARED) pages, each container really using a memory page is charged for the fraction of the page (depending on the number of others using it). For "potentially private" pages (mapped as MAP_PRIVATE), container is charged either for a fraction of the size or for the full size if the allocated address space. In the latter case, the physical pages associated with the allocated address space may be in memory, in swap or not physically allocated yet.

The barrier and the limit of this parameter control the upper boundary of the total size of allocated memory. Note that this upper boundary does not guarantee that container will be able to allocate that much memory. The primary mechanism to control memory allocation is the --vmguarpages guarantee.

--shmpages pages[:pages]

Maximum IPC SHM segment size. Setting the barrier and the limit to different values does not make practical sense.

--numfile items[:items]

Maximum number of open files. In most cases the barrier and the limit should be set to the same value. Setting the barrier to 0 effectively disables pre-charging optimization for this beancounter in the kernel, which leads to the held value being precise but could slightly degrade file open performance.

--numflock items[:items]

Maximum number of file locks. Safety gap should be between barrier and limit.

--numpty items[:items]

Number of pseudo-terminals (PTY). Note that in OpenVZ each container can have not more than 255 PTYs. Setting the barrier and the limit to different values does not make practical sense.

--numsiginfo items[:items]

Number of siginfo structures. Setting the barrier and the limit to different values does not make practical sense.

--dcachesize bytes[:bytes]

Maximum size of filesystem-related caches, such as directory entry and inode caches. Exists as a separate parameter to impose a limit causing file operations to sense memory shortage and return an errno to applications, protecting from memory shortages during critical operations that should not fail. Safety gap should be between barrier and limit.

--numiptent num[:num]

Number of iptables (netfilter) entries. Setting the barrier and the limit to different values does not make practical sense.

--physpages pages[:pages]

On VSwap-enabled kernels, this limits the amount of physical memory (RAM) available to a container. The barrier should be set to 0, and the limit to a total size of RAM that can be used used by a container.

For older kernels, this is an accounting-only parameter, showing the usage of RAM by this container. Barrier should be set to 0, and limit should be set to unlimited.

--swappages pages[:pages]

For VSwap-enabled kernels (042stab042 or greater), this parameter limits the amount of swap space available to a container. The barrier should be set to 0, and the limit to a total size of swap that can be used by a container.

For older (pre-VSwap) kernels, the limit is used to show a total amount of swap space available inside the container. The barrier of this parameter is ignored. The default value is unlimited, meaning total swap will be reported as 0.

CPU fair scheduler parameters

These parameters control CPU usage by container.
--cpuunits
num

CPU weight for a container. Argument is positive non-zero number, passed to and used in the kernel fair scheduler. The larger the number is, the more CPU time this container gets. Maximum value is 500000, minimal is 8. Number is relative to weights of all the other running containers. If cpuunits are not specified, default value of 1000 is used.

You can set CPU weight for CT0 (host system itself) as well (use vzctl set 0 --cpuunits num). Usually, OpenVZ initscript (/etc/init.d/vz) takes care of setting this.

--cpulimit num[%]

Limit of CPU usage for the container, in per cent. Note if the computer has 2 CPUs, it has total of 200% CPU time. Default CPU limit is 0 (no CPU limit).

--cpus num

sets number of CPUs available in the container.

--cpumask cpus | auto | all

Sets list of allowed CPUs for the container. Input format is a comma-separated list of decimal numbers and/or ranges. Consecutively set bits are shown as two hyphen-separated decimal numbers, the smallest and largest bit numbers set in the range. For example, if you want the container to execute on CPUs 0, 1, 2, 7, you should pass 0-2,7. Default value is all (the container can execute on any CPU). If used with the --nodemask option, value of auto assigns all CPUs from the specified NUMA node to a container.

--nodemask nodes | all

Sets list of allowed NUMA nodes for the container. Input format is the same as for --cpumask. Note that --nodemask must be used with the --cpumask option.

Memory output parameters

For VSwap-enabled kernels (042stab042 or greater), this parameter is ignored. For older kernels, it controls the output of /proc/meminfo inside a container.
--meminfo none

No /proc/meminfo virtualization (the same as on host system).

--meminfo mode:value

Configure total memory output in a container. Reported free memory is evaluated accordingly to the mode being set. Reported swap is evaluated according to the settings of --swappages parameter.

You can use the following modes for mode:
pages:value - sets total memory in pages;
privvmpages:value - sets total memory as privvmpages * value.

Default is privvmpages:1.

Netfilter (iptables) control parameters

--netfilter disabled|stateless|stateful|full

Restrict access to netfilter/iptables modules for a container. This option replaces obsoleted --iptables.

Note that changing this parameter requires container restart, so consider using --setmode option.

The following arguments can be used:
• disabled

no modules are allowed

• stateless

all modules except NAT and conntracks are allowed (i.e. filter and mangle); this is the default

• stateful

all modules except NAT are allowed

• full

all modules are allowed

--iptables name[,...]

Note this option is obsoleted, --netfilter should be used instead.

Allow to use the functionality of name iptables module inside the container. Multiple comma-separated names can be specified.

The default list of enabled iptables modules is defined by the IPTABLES variable in vz.conf(5).

You can use the following values for name: iptable_filter, iptable_mangle, ipt_limit, ipt_multiport, ipt_tos, ipt_TOS, ipt_REJECT, ipt_TCPMSS, ipt_tcpmss, ipt_ttl, ipt_LOG, ipt_length, ip_conntrack, ip_conntrack_ftp, ip_conntrack_irc, ipt_conntrack, ipt_state, ipt_helper, iptable_nat, ip_nat_ftp, ip_nat_irc, ipt_REDIRECT, xt_mac, ipt_recent, ipt_owner.

Network devices control parameters

--netdev_add name

move network device from the host system to a specified container

--netdev_del name

delete network device from a specified container

Disk quota parameters

--diskquota yes | no

allows to enable or disable disk quota for a container. By default, a global value (DISK_QUOTA) from vz.conf(5) is used.

Note that this parameter is ignored for ploop layout.

--diskspace num[:num]

For simfs layout, sets soft and hard disk quota limits. First parameter is soft limit, second is hard limit.

For ploop layout, initiates the procedure of resizing the ploop image file to the new size. Since there is no soft/hard limit concept in ploop, second num, if specified, is ignored.

By default, ploop resize is done online, i.e. on a mounted ploop. This is a preferred way of doing resize. Although, in a rare case a container was using lots of disk space and should now be resized to a much smaller size, an offline resize might be more appropriate. In this case, make sure the container is stopped and unmounted and use additional --offline-resize option

Note that ploop resize is NOT performed on container start, so for consistency --diskspace must be used together with --save flag.

Suffixes G, M, K can also be specified (see Resource limits section for more info on suffixes). If suffix is not specified, value is in kilobytes.

--diskinodes num[:num]

sets soft and hard disk quota limits, in i-nodes. First parameter is soft limit, second is hard limit.

Note that this parameter is ignored for ploop layout.

--quotatime seconds

sets quota grace period. Container is permitted to exceed its soft limits for the grace period, but once it has expired, the soft limit is enforced as a hard limit.

Note that this parameter is ignored for ploop layout.

--quotaugidlimit num

Enables or disables in-container per-user and per-group disk quotas. If the value is set to 0 or not set, disk quotas inside the container is disabled and not accounted.

For simfs layout containers, non-zero value sets maximum number of user/group IDs for which disk quota is accounted.

For ploop layout containers, any non-zero value enables disk quota inside the container; the number of user/group IDs used by disk quota is not limited by OpenVZ.

Note that enabling or disabling in-container disk quotas requires container restart, so consider using --setmode option.

Capability option

--capability capname:on|off[,...]

Sets a capability for a container. Multiple comma-separated capabilities can be specified.

Note that setting a capability when the container is running does not take immediate effect; restart the container in order for the changes to take effect (consider using --setmode option).

A container has the default set of capabilities, thus any operation on capabilities is "logical AND" with the default capability mask.

You can use the following values for capname: chown, dac_override, dac_read_search, fowner, fsetid, kill, setgid, setuid, setpcap, linux_immutable, net_bind_service, net_broadcast, net_admin, net_raw, ipc_lock, ipc_owner, sys_module, sys_rawio, sys_chroot, sys_ptrace, sys_pacct, sys_admin, sys_boot, sys_nice, sys_resource, sys_time, sys_tty_config, mknod, lease, setveid, ve_admin. For detailed description, see capabilities(7).

WARNING: setting some of those capabilities may have far reaching security implications, so do not do it unless you know what you are doing. Also note that setting setpcap:on for a container will most probably lead to inability to start it.

Device access management

--devnodes device:[r][w][q]|none

Give the container an access (r - read, w - write, q - disk quota management, none - no access) to a device designated by the special file /dev/device. Device file is created in a container by vzctl. Example:

   vzctl set 777 --devnodes sdb:rwq

--devices b|c:major:minor|all:[r][w][q]|none

Give the container an access to a block or character device designated by its major and minor numbers. Device file have to be created manually.

PCI device management

--pci_add [domain:]bus:slot.func

Give the container an access to a specified PCI device. All numbers are hexadecimal (as printed by lspci(8) in the first column).

--pci_del [domain:]bus:slot.func

Delete a PCI device from the container.

Note that vps-pci configuration script is executed by vzctl then configuring PCI devices. The script is usually located at /usr/libexec/vzctl/scripts/.

Features management

--features name:on|off[,...]

Enable or disable a specific container feature. Known features are: sysfs, nfs, sit, ipip, ppp, ipgre, bridge, nfsd. A few features can be specified at once, comma-separated.

Apply config

--applyconfig name

Read container parameters from the container sample configuration file /etc/vz/conf/ve-name.conf-sample, and apply them, if --save option specified save to the container config file. The following parameters are not changed: HOSTNAME, IP_ADDRESS, OSTEMPLATE, VE_ROOT, and VE_PRIVATE.

--applyconfig_map group

Apply container config parameters selected by group. Now the only possible value for group is name: to restore container name based on NAME variable in container configuration file.

I/O scheduling

--ioprio priority

Assigns disk I/O priority to container. Priority range is 0-7. The greater priority is, the more time for I/O activity container has. By default each container has priority of 4.

--iolimit limit[B|K|M|G]

Assigns disk I/O bandwidth limit for a container. Value is either a number with an optional suffix, or a literal string unlimited. Value of 0 means "unlimited". By default a container has no I/O limit. Maximum allowed limit is 2 gigabytes per second; values exceeding the limit are truncated.

If no suffix is provided, the limit is assumed to be in megabytes per second. Available suffixes are:
b, B -- bytes per second;
k, K -- kilobytes per second;
m, M -- megabytes per second (default);
g, G -- gigabytes per second;

--iopslimit iops

Assigns IOPS limit for a container, in number of input/output operations per second. Value is a number or a literal string unlimited. Value of 0 means "unlimited". By default a container has no IOPS limit.

Suspending and resuming

Checkpointing is a feature of OpenVZ kernel which allows to save a complete in-kernel state of a running container, and to restore it later.

suspend|chkpnt CTID [--dumpfile name]

This command suspends a container to a dump file If an option --dumpfile is not set, default dump file name /vz/dump/Dump.CTID is used.

resume|restore CTID [--dumpfile name]

This command restores a container from the dump file created by the suspend command.

Snapshotting

Snapshotting is a feature based on checkpointing and ploop shapshots. It allows to save a complete state of container file system. Plus, if the container is running, it’s in-memory state (as in checkpointing). Note that snapshot functionality is only working for containers on ploop device.

snapshot CTID [--id uuid] [--name name] [--description desc]
[--skip-suspend] [--skip-config]

Creates a container snapshot, i.e. saves the current container state, including its file system state, running processes state, and configuration file.

If a container is running, and --skip-suspend option is not specified, a container is checkpointed and then restored, and CT memory dump becomes the part of snapshot.

Unless --skip-config option is given, container configuration file is saved to the snapshot.

If uuid is not specified, it is auto-generated. Options --name and --description can be used to specify the snapshot name and description, respectively. Name is displayed by snapshot-list.

snapshot-switch CTID [--skip-resume | --must-resume] [--skip-config]
--id
uuid

Switches the container to a snapshot identified by uuid, restoring its file system state, configuration (if available) and its running state (if available).

Note that the current state of a container (including its file system state and its configuration file) is lost!

Option --skip-resume is used to ignore a CT memory dump file in a snapshot, as a result the container will end up being in a stopped state (same as if a snapshot has been taken with --skip-suspend).

If option --must-resume is set, absense of a memory dump is treated as an error, and the inability to restore from the memory dump is treated as an error rather than warning.

Option option --skip-config is used to ignore the CT configuration file in a snapshot, i.e. the current configuration file will be left as is.

snapshot-delete CTID --id uuid

Removes a specified snapshot.

snapshot-mount CTID --id uuid --target directory

Mounts a snapshot specified by uuid to a directory. Note this mount is read-only.

snapshot-umount CTID --id uuid

Unmounts a specified snapshot.

snapshot-list CTID [-H] [-o field[,field...] [--id uuid]

List container’s snapshots.

You can suppress displaying header using -H option.

You can use the -o option to display only the specified field(s). List of available fields can be obtained using -L option.

Performing container actions

create

CTID [--ostemplate name] [--config name] [--layout simfs|ploop[:{expanded|plain|raw}]] [--diskspace kbytes] [--diskinodes num] [--private path] [--root path] [--ipadd addr] [--hostname name] [--name name] [--local_uid uid] [--local_gid gid]

Creates a new container area. This operation should be done once, before the first start of the container.

By default, an OS template denoted by DEF_OSTEMPLATE parameter of vz.conf(5) is used to create a container. This can be overwritten by --ostemplate option.

By default, a new container configuration file is created from a sample configuration denoted by value of CONFIGFILE parameter of vz.conf(5). If the container configuration file already exists, it will not be modified.

The value of CONFIGFILE can be overwritten by using the --config name option. This option can not be used if the container configuration file already exists.

A new container can either be created using simfs filesystem or on a ploop device. The default is set by value of VE_LAYOUT parameter of vz.conf(5) and can be overwritten by --layout option. In case ploop is used, one can additionally specify ploop disk image format after a colon. Possible ploop formats are expanded, plain and raw. Default is expanded. Using value other than expanded is not recommended and is currently not supported.

You can use --diskspace and --diskinodes options to specify container file system size. Note that for ploop layout, you will not be able to change inodes value later.

If DISKSPACE is not specified either in the sample configuration file used for creation or in global configuration file vz.conf(5), --diskspace parameter is required for ploop layout.

Suffixes G, M, K can also be specified (see Resource limits section for more info on suffixes).

You can use --root path option to sets the path to the mount point for the container root directory (default is VE_ROOT specified in vz.conf(5) file). Argument can contain literal string $VEID, which will be substituted with the numeric CT ID.

You can use --private path option to set the path to directory in which all the files and directories specific to this very container are stored (default is VE_PRIVATE specified in vz.conf(5) file). Argument can contain literal string $VEID, which will be substituted with the numeric CT ID.

You can use --ipadd addr option to assign an IP address to a container. Note that this option can be used multiple times.

You can use --hostname name option to set a host name for a container.

When running with an upstream Linux Kernel that supports user namespaces (>= 3.8), the parameters --local_uid and --local_gid can be used to select which uid and gid respectively will be used as a base user in the host system. Note that user namespaces provide a 1:1 mapping between container users and host users. If these options are not specified, the values LOCAL_UID and LOCAL_GID from global configuration file vz.conf(5) are used. An explicit --local_uid value of 0 will disable user namespace support, and run the container as a privileged user. In this case, --local_gid is ignored.

Warning: use --local_uid and --local_gid with care, specially when migrating containers. In all situations, the container’s files in the filesystem needs to be correctly owned by the host-side users.

destroy | delete CTID

Removes a container private area by deleting all files, directories and the configuration file of this container.

start CTID [--wait] [--force] [--skip-fsck] [--skip-remount]

Mounts (if necessary) and starts a container. Unless --wait option is specified, vzctl will return immediately; otherwise an attempt to wait till the default runlevel is reached will be made by vzctl.

Specify --force if you want to start a container which is disabled (see --disabled).

Specify --skip-fsck to skip fsck for ploop-based container filesystem (this option is used by vz initscript).

By default, if a container to be started happens to be already mounted, it is unmounted and mounted again. This behavior can be turned off by using --skip-remount flag.

Note that this command can lead to execution of premount, mount and start action scripts (see ACTION SCRIPTS below).

stop CTID [--fast] [--skip-umount]

Stops a container and unmounts it (unless --skip-umount is given). Normally, halt(8) is executed inside a container; option --fast makes vzctl use reboot(2) syscall instead which is faster but can lead to unclean container shutdown.

Note that vzctl stop is not asyncronous, in other words vzctl waits for container’s init to exit (unless --fast is given), which can take up to a few minutes. Default wait timeout is 120 seconds; it can be changed globally, by setting STOP_TIMEOUT in vz.conf(5), or per container (STOP_TIMEOUT in ctid.conf(5), see --stop-timeout).

Note that this command can lead to execution of stop, umount and postumount action scripts (see ACTION SCRIPTS below).

restart CTID [--wait] [--force] [--fast] [--skip-fsck]

Restarts a container, i.e. stops it if it is running, and starts again. Accepts all the start and stop options.

Note that this command can lead to execution of some action scripts (see ACTION SCRIPTS below).

status CTID

Shows a container status. This is a line with five or six words, separated by spaces.

First word is literally CTID.

Second word is the numeric CT ID.

Third word is showing whether this container exists or not, it can be either exist or deleted.

Fourth word is showing the status of the container filesystem, it can be either mounted or unmounted.

Fifth word shows if the container is running, it can be either running or down.

Sixth word, if exists, is suspended. It appears if a dump file exists for a stopped container (see suspend).

This command can also be usable from scripts.

mount CTID

Mounts container private area. Note that this command can lead to execution of premount and mount action scripts (see ACTION SCRIPTS below).

umount CTID

Unmounts container private area. Note that this command can lead to execution of umount and postumount action scripts (see ACTION SCRIPTS below).

Note that stop does umount automatically.

convert CTID [--layout ploop[:{expanded|plain|raw}]]

Convert CT private area to reside on a ploop device (available in kernel version 042stab052.8 and greater). Conversion should be performed when a container is stopped, plus disk space quota should be set.

compact CTID

Compact container image. This only makes sense for ploop layout.

quotaon CTID

Turn disk quota on. Not that mount and start does that automatically.

quotaoff CTID

Turn disk quota off. Not that umount and stop does that automatically.

quotainit CTID

Initialize disk quota (i.e. run vzquota init) with the parameters taken from the CT configuration file ctid.conf(5).

exec CTID command

Executes command in a container. Environment variables are not set inside the container. Signal handlers may differ from default settings. If command is -, commands are read from stdin.

exec2 CTID command

The same as exec, but return code is that of command.

runscript CTID script

Run specified shell script in the container. Argument script is a file on the host system which contents is read by vzctl and executed in the context of the container. For a running container, the command jumps into the container and executes the script. For a stopped container, it enters the container, mounts container’s root filesystem, executes the script, and unmounts CT root. In the latter case, the container is not really started, no file systems other than root (such as /proc) are mounted, no startup scripts are executed etc. Thus the environment in which the script is running is far from normal and is only usable for very basic operations.

enter CTID [--exec command [arg ...]]

Enters into a container (giving a container’s root shell). This option is a back-door for host root only. The proper way to have CT root shell is to use ssh(1).

Option --exec is used to run command with arguments after entering into container. This is useful if command to be run requires a terminal (so vzctl exec can not be used) and for some reason you can not use ssh(1).

You need to log out manually from the shell to finish session (even if you specified --exec).

console CTID [ttynum]

Attach to a container console. Optional ttynum argument is tty number (such as 4 for tty4), default is 1 which is used for container’s /dev/console.

Note the consoles are persistent, meaning that:
• it can be attached to even if the container is not running;
• there is no automatic detachment upon the container stop;
• detaching from the console leaves anything running in this console as is.

The following escape sequences are recognized by vzctl console. Note that these sequences are only recognized at the beginning of a line.

Esc then . to detach from the console.

Esc then ! to kill anything running on the console (SAK). This is helpful when one expects a login prompt but there isn’t one.

Other options

--help

Prints help message with a brief list of possible options.

--version

Prints vzctl version.

ACTION SCRIPTS

vzctl has an ability to execute user-defined scripts when a specific vzctl command is run for a container. The following vzctl commands can trigger execution of action scripts: start, stop, restart, mount and umount.

Action scripts are located in the /etc/vz/conf/ directory. There are global and per-CT scripts. Global scripts have a literal prefix of vps. and are executed for all containers. Per-CT scripts have a CTID. numeric prefix and are executed for the given container only.

Please note scripts are executed in a host system (CT0) context, with the exception of .start and .stop scripts, which are executed in a container context.

The following action scripts are currently defined:
vps.premount
, CTID.premount

Global and per-CT mount scripts which are executed for a container before it is mounted. Scripts are executed in the host system context, while a CT is not yet mounted or running. Global script, if exists, is executed first.

vps.mount, CTID.mount

Global and per-CT mount scripts which are executed for a container right after it is mounted. Otherwise they are the same as .premount scripts.

CTID.start

Right after vzctl has started a container, it executes this script in a container context.

CTID.stop

Right before vzctl has stopped a container, it executes this script in a container context.

vps.umount, CTID.umount

Global and per-CT umount scripts which are executed for a container before it is unmounted. Scripts are executed in the host system context, while a CT is mounted. Global script, if exists, is executed first.

vps.postumount, CTID.postumount

Global and per-CT umount scripts which are executed for a container right after it is unmounted. Otherwise they are the same as .umount scripts.

The environment passed to all the *mount scripts is the standard environment of the parent (i.e. vzctl) with two additional variables: $VEID and $VE_CONFFILE. The first one holds the ID of the container, and the second one holds the full path to the container configuration file. If the script needs to get other CT configuration parameters, such as $VE_ROOT, it needs to get those from global and per-CT configuration files.

Here is an example of a mount script, which makes host system’s /mnt/disk available to container(s). Script name can either be /etc/vz/conf/vps.mount or /etc/vz/conf/CTID.mount.

   # If one of these files does not exist then something
   # is really broken
   [ -f /etc/vz/vz.conf ] || exit 1
   [ -f $VE_CONFFILE ] || exit 1
   # Source both files. Note the order is important.
   . /etc/vz/vz.conf
   . $VE_CONFFILE
   SRC=/mnt/disk
   DST=/mnt/disk
   mount -n -t simfs $SRC ${VE_ROOT}${DST} -o $SRC

EXIT STATUS

Returns 0 upon success, or an appropriate error code in case of an error:

1

Failed to set a UBC parameter

2

Failed to set a fair scheduler parameter

3

Generic system error

5

The running kernel is not an OpenVZ kernel (or some OpenVZ modules are not loaded)

6

Not enough system resources

7

ENV_CREATE ioctl failed

8

Command executed by vzctl exec returned non-zero exit code

9

Container is locked by another vzctl invocation

10

Global OpenVZ configuration file vz.conf(5) not found

11

A vzctl helper script file not found

12

Permission denied

13

Capability setting failed

14

Container configuration file ctid.conf(5) not found

15

Timeout on vzctl exec

16

Error during vzctl suspend

17

Error during vzctl resume

18

Error from setluid() syscall

20

Invalid command line parameter

21

Invalid value for command line parameter

22

Container root directory (VE_ROOT) not set

23

Container private directory (VE_PRIVATE) not set

24

Container template directory (TEMPLATE) not set

28

Not all required UBC parameters are set, unable to start container

29

OS template is not specified, unable to create container

31

Container not running

32

Container already running

33

Unable to stop container

34

Unable to add IP address to container

40

Container not mounted

41

Container already mounted

43

Container private area not found

44

Container private area already exists

46

Not enough disk space

47

Bad/broken container (/sbin/init or /bin/sh not found)

48

Unable to create a new container private area

49

Unable to create a new container root area

50

Unable to mount container

51

Unable to unmount container

52

Unable to delete a container

53

Container private area not exist

60

vzquota on failed

61

vzquota init failed

62

vzquota setlimit failed

63

Parameter DISKSPACE not set

64

Parameter DISKINODES not set

65

Error setting in-container disk quotas

66

vzquota off failed

67

ugid quota not initialized

71

Incorrect IP address format

74

Error changing password

78

IP address already in use

79

Container action script returned an error

82

Config file copying error

86

Error setting devices (--devices or --devnodes)

89

IP address not available

91

OS template not found

99

Ploop is not supported by either the running kernel or vzctl.

100

Unable to find container IP address

104

VE_NETDEV ioctl error

105

Container start disabled

106

Unable to set iptables on a running container

107

Distribution-specific configuration file not found

109

Unable to apply a config

129

Unable to set meminfo parameter

130

Error setting veth interface

131

Error setting container name

133

Waiting for container start failed

139

Error saving container configuration file

148

Error setting container IO parameters (ioprio)

150

Ploop image file not found

151

Error creating ploop image

152

Error mounting ploop image

153

Error unmounting ploop image

154

Error resizing ploop image

155

Error converting container to ploop layout

156

Error creating ploop snapshot

157

Error merging ploop snapshot

158

Error deleting ploop snapshot

159

Error switching ploop snapshot

166

Error compacting ploop image

167

Error listing ploop snapsots

EXAMPLES

To create and start "basic" container with ID of 1000 using centos-5 OS template and IP address of 192.168.10.200:

   vzctl create 1000 --ostemplate centos-5 --config basic
   vzctl set 1000 --ipadd 192.168.10.200 --save
   vzctl start 1000

To set number of processes barrier/limit to 80/100, and PTY barrier/limit to 16/20 PTYs:

   vzctl set 1000 --numproc 80:100 -t 16:20 --save

To execute command ls -la in this container:

   vzctl exec 1000 /bin/ls -la

To execute command pipe ls -l / | sort in this container:

   vzctl exec 1000 ’ls -l / | sort’

To enter this container and execute command apt-get install vim:

   vzctl enter 1000 --exec apt-get install vim

Note that in the above example you will need to log out from the container’s shell after apt-get finishes.

To enter this container, execute command apt-get install vim and logout after successful installation (or stay inside the container if installation process failed) use &&:

   vzctl enter 1000 --exec "apt-get install vim && logout"

To enter this container, execute command apt-get install vim and logout independently of exit code of installation process use ;:

   vzctl enter 1000 --exec "apt-get install vim ; logout"

Note that you need to quote the command if you use && or ;.

To stop this container:

   vzctl stop 1000

To permanently remove this container:

   vzctl destroy 1000

FILES

/etc/vz/vz.conf
/etc/vz/conf/<i>CTID</i>.conf
/etc/vz/conf/vps.{premount,mount,umount,postumount}
/etc/vz/conf/<i>CTID</i>.{premount,mount,start,stop,umount,postumount}
/proc/vz/veinfo
/proc/vz/vzquota
/proc/user_beancounters
/proc/bc/*
/proc/fairsched

SEE ALSO

vz.conf(5), ctid.conf(5), arpsend(8), vzcalc(8), vzcfgvalidate(8), vzcpucheck(8), vzifup-post(8), vzlist(8), vzmemcheck(8), vzmigrate(8), vzpid(8), vzquota(8), vzsplit(8), vzubc(8), UBC.

LICENSE

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