lxc-clone.sgml.in revision 585f3c6b6942e82a25af1d68672fd4744ecfa09d
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksa<!--
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksa
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksalxc: linux Container library
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksa
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksa(C) Copyright IBM Corp. 2007, 2008
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksa
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen KuksaAuthors:
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen KuksaDaniel Lezcano <daniel.lezcano at free.fr>
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen KuksaSerge Hallyn <serge.hallyn at ubuntu.com>
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksa
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen KuksaThis library is free software; you can redistribute it and/or
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksamodify it under the terms of the GNU Lesser General Public
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen KuksaLicense as published by the Free Software Foundation; either
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksaversion 2.1 of the License, or (at your option) any later version.
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksa
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen KuksaThis library is distributed in the hope that it will be useful,
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksabut WITHOUT ANY WARRANTY; without even the implied warranty of
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen KuksaMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen KuksaLesser General Public License for more details.
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksa
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen KuksaYou should have received a copy of the GNU Lesser General Public
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen KuksaLicense along with this library; if not, write to the Free Software
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen KuksaFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksa
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksa-->
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksa
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksa<!DOCTYPE refentry PUBLIC @docdtd@ [
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksa
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksa<!ENTITY commonoptions SYSTEM "@builddir@/common_options.sgml">
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksa<!ENTITY seealso SYSTEM "@builddir@/see_also.sgml">
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksa]>
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksa
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksa<refentry>
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksa
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksa <docinfo><date>@LXC_GENERATE_DATE@</date></docinfo>
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksa
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksa <refmeta>
be16f35e063c5c6d4fa08018600d206322bc0c19Eugen Kuksa <refentrytitle>lxc-clone</refentrytitle>
<manvolnum>1</manvolnum>
</refmeta>
<refnamediv>
<refname>lxc-clone</refname>
<refpurpose>
clone a new container from an existing one.
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>lxc-clone</command>
<arg choice="opt">-s </arg>
<arg choice="opt">-K </arg>
<arg choice="opt">-M </arg>
<arg choice="opt">-H </arg>
<arg choice="opt">-B <replaceable>backingstore</replaceable></arg>
<arg choice="opt">-L <replaceable>fssize</replaceable></arg>
<arg choice="opt">-p <replaceable>lxcpath</replaceable></arg>
<arg choice="opt">-P <replaceable>newlxcpath</replaceable></arg>
<arg choice="opt">-R </arg>
<arg choice="req">-o <replaceable>orig</replaceable></arg>
<arg choice="req">-n <replaceable>new</replaceable></arg>
<arg choice="opt">-- hook arguments</arg>
</cmdsynopsis>
<cmdsynopsis>
<command>lxc-clone</command>
<arg choice="opt">-s </arg>
<arg choice="opt">-K </arg>
<arg choice="opt">-M </arg>
<arg choice="opt">-H </arg>
<arg choice="opt">-B <replaceable>backingstore</replaceable></arg>
<arg choice="opt">-L <replaceable>fssize</replaceable></arg>
<arg choice="opt">-p <replaceable>lxcpath</replaceable></arg>
<arg choice="opt">-P <replaceable>newlxcpath</replaceable></arg>
<arg choice="opt">-R </arg>
<arg choice="req">orig</arg>
<arg choice="req">new</arg>
<arg choice="opt">-- hook arguments</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
<command>lxc-clone</command> Creates a new container as a clone of an existing
container. Two types of clones are supported: copy and snapshot. A copy
clone copies the root filessytem from the original container to the new. A
snapshot filesystem uses the backing store's snapshot functionality to create
a very small copy-on-write snapshot of the original container. Snapshot
clones require the new container backing store to support snapshotting. Currently
this includes only aufs, btrfs, lvm, overlayfs and zfs. LVM devices do not support
snapshots of snapshots.
</para>
<para>
The backing store of the new container will be the same type as the
original container, with one exception, overlay containers.
aufs and overlayfs snapshots can be created of directory backed
containers. This can be requested by using (for overlayfs) the
<replaceable>-B overlayfs</replaceable> arguments.
</para>
<para>
The names of the original and new container can be given (in that order)
after all options, or can be specified with the
<replaceable>-o</replaceable> and <replaceable>-n</replaceable> options,
respectively.
</para>
</refsect1>
<refsect1>
<title>Options</title>
<variablelist>
<varlistentry>
<term>
<option>-s, --snapshot</option>
</term>
<listitem>
<para>
The new container's rootfs will be a snapshot of the original. This option can be specified when the backing store is LVM, btrfs or zfs, and must be specified when you want to snapshot using aufs or overlayfs.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-K, --keepname</option>
</term>
<listitem>
<para>
Do not change the hostname of the container (in the root
filesystem).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-M, --keepmac</option>
</term>
<listitem>
<para>
Use the same MAC address as the original container, rather than
generating a new random one.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-H, --copyhooks</option>
</term>
<listitem>
<para>
Copy all mount hooks into the new container's directory, and
update any lxcpaths and container names as needed.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-L, --fssize <replaceable>fssize</replaceable></option>
</term>
<listitem>
<para>
In the case of a block device backed container, a size for the new
block device. By default, the new device will be made the
same size as the original.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-p, --lxcpath <replaceable>lxcpath</replaceable></option>
</term>
<listitem>
<para>
The lxcpath of the original container. By default, the system
wide configured lxcpath will be used.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-P, --newpath <replaceable>newlxcpath</replaceable></option>
</term>
<listitem>
<para>
The lxcpath for the new container. By default the same lxcpath
as the original will be used. Note that with btrfs snapshots,
changing lxcpaths may not be possible, as subvolume snapshots
must be in the same btrfs filesystem.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-B, --backingstore <replaceable>backingstore</replaceable></option>
</term>
<listitem>
<para>
Select a different backing store for the new container. By
default the same as the original container's is used. Note that
currently changing the backingstore is only supported for
aufs and overlayfs snapshots of directory backed containers. Valid
backing stores include dir (directory), aufs, btrfs, lvm, zfs, loop
and overlayfs.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-R, --rename</option>
</term>
<listitem>
<para>
Rename an existing container.
<replaceable>orig</replaceable> is renamed <replaceable>new</replaceable>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-o, --orig <replaceable>orig</replaceable></option>
</term>
<listitem>
<para>
The name of the original container to clone.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-n, --new <replaceable>new</replaceable></option>
</term>
<listitem>
<para>
The name of the new container to create.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Clone hook</title>
<para>
If the container being cloned has one or more <filename>lxc.hook.clone</filename>
specified, then the specified hooks will be called for the new container. The
first 3 arguments passed to the clone hook will be the container name, a section
('lxc'), and the hook type ('clone'). Extra arguments passed
<command>lxc-clone</command> will be passed to the hook program starting at
argument 4. The <filename>LXC_ROOTFS_MOUNT</filename> environment variable gives
the path under which the container's root filesystem is mounted. The
configuration file pathname is stored in <filename>LXC_CONFIG_FILE</filename>, the
new container name in <filename>LXC_NAME</filename>, the old container name in
<filename>LXC_SRC_NAME</filename>, and the path or device on which
the rootfs is located is in <filename>LXC_ROOTFS_PATH</filename>.
</para>
</refsect1>
&seealso;
<refsect1>
<title>Author</title>
<para>Serge Hallyn <email>serge.hallyn@ubuntu.com</email></para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:2
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:nil
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->