lxc-clone.sgml.in revision 02e5d92b70562457a963f0803f0069053ce3292b
1923N/A<!--
1923N/A
1923N/Alxc: linux Container library
1923N/A
1923N/A(C) Copyright IBM Corp. 2007, 2008
1923N/A
1923N/AAuthors:
1923N/ADaniel Lezcano <daniel.lezcano at free.fr>
1923N/ASerge Hallyn <serge.hallyn at ubuntu.com>
1923N/A
1923N/AThis library is free software; you can redistribute it and/or
1923N/Amodify it under the terms of the GNU Lesser General Public
1923N/ALicense as published by the Free Software Foundation; either
1923N/Aversion 2.1 of the License, or (at your option) any later version.
1923N/A
1923N/AThis library is distributed in the hope that it will be useful,
1923N/Abut WITHOUT ANY WARRANTY; without even the implied warranty of
1923N/AMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1923N/ALesser General Public License for more details.
1923N/A
1923N/AYou should have received a copy of the GNU Lesser General Public
1923N/ALicense along with this library; if not, write to the Free Software
1923N/AFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1923N/A
1923N/A-->
1923N/A
1923N/A<!DOCTYPE refentry PUBLIC @docdtd@ [
1923N/A
1923N/A<!ENTITY commonoptions SYSTEM "@builddir@/common_options.sgml">
1923N/A<!ENTITY seealso SYSTEM "@builddir@/see_also.sgml">
1923N/A]>
1923N/A
1923N/A<refentry>
1923N/A
1923N/A <docinfo><date>@LXC_GENERATE_DATE@</date></docinfo>
1923N/A
1923N/A <refmeta>
1923N/A <refentrytitle>lxc-clone</refentrytitle>
1923N/A <manvolnum>1</manvolnum>
1923N/A </refmeta>
1923N/A
1923N/A <refnamediv>
1923N/A <refname>lxc-clone</refname>
1923N/A
1923N/A <refpurpose>
1923N/A clone a new container from an existing one.
1923N/A </refpurpose>
1923N/A </refnamediv>
1923N/A
1923N/A <refsynopsisdiv>
1923N/A <cmdsynopsis>
1923N/A <command>lxc-clone</command>
1923N/A <arg choice="opt">-s </arg>
1923N/A <arg choice="opt">-K </arg>
1923N/A <arg choice="opt">-M </arg>
1923N/A <arg choice="opt">-H </arg>
1923N/A <arg choice="opt">-B <replaceable>backingstore</replaceable></arg>
1923N/A <arg choice="opt">-L <replaceable>fssize</replaceable></arg>
1923N/A <arg choice="opt">-p <replaceable>lxcpath</replaceable></arg>
1923N/A <arg choice="opt">-P <replaceable>newlxcpath</replaceable></arg>
1923N/A <arg choice="opt">-R </arg>
1923N/A <arg choice="req">-o <replaceable>orig</replaceable></arg>
1923N/A <arg choice="req">-n <replaceable>new</replaceable></arg>
1923N/A <arg choice="opt">-- hook arguments</arg>
1923N/A </cmdsynopsis>
1923N/A <cmdsynopsis>
1923N/A <command>lxc-clone</command>
1923N/A <arg choice="opt">-s </arg>
1923N/A <arg choice="opt">-K </arg>
1923N/A <arg choice="opt">-M </arg>
1923N/A <arg choice="opt">-H </arg>
1923N/A <arg choice="opt">-B <replaceable>backingstore</replaceable></arg>
1923N/A <arg choice="opt">-L <replaceable>fssize</replaceable></arg>
1923N/A <arg choice="opt">-p <replaceable>lxcpath</replaceable></arg>
1923N/A <arg choice="opt">-P <replaceable>newlxcpath</replaceable></arg>
1923N/A <arg choice="opt">-R </arg>
1923N/A <arg choice="req">orig</arg>
1923N/A <arg choice="req">new</arg>
1923N/A <arg choice="opt">-- hook arguments</arg>
1923N/A </cmdsynopsis>
1923N/A </refsynopsisdiv>
1923N/A
1923N/A <refsect1>
1923N/A <title>Description</title>
1923N/A
1923N/A <para>
1923N/A <command>lxc-clone</command> Creates a new container as a clone of an existing
1923N/A container. Two types of clones are supported: copy and snapshot. A copy
1923N/A clone copies the root filessytem from the original container to the new. A
1923N/A snapshot filesystem uses the backing store's snapshot functionality to create
1923N/A a very small copy-on-write snapshot of the original container. Snapshot
1923N/A clones require the new container backing store to support snapshotting. Currently
1923N/A this includes only aufs, btrfs, lvm, overlayfs and zfs. LVM devices do not support
1923N/A snapshots of snapshots.
1923N/A </para>
1923N/A
1923N/A <para>
1923N/A The backing store of the new container will be the same type as the
1923N/A original container, with one exception, overlay containers.
1923N/A aufs and overlayfs snapshots can be created of directory backed
1923N/A 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>
<refsect1>
<title>Notes</title>
<para>
<command>lxc-clone</command> is superseded by <command>lxc-copy</command>.
</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:
-->