mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-27 03:44:32 +00:00

1. commonize waitpid users to use a single helper. We frequently want to run something in a clean namespace, or fork off a script. This lets us keep the function doing fork:(1)exec(2)waitpid simpler. 2. start a blockdev backend implementation. This will be used for mounting, copying, and snapshotting container filesystems. 3. implement btrfs, lvm, directory, and overlayfs backends. 4. For overlayfs, support a new lxc.rootfs format of 'bdevtype:<extra>'. This means you can now use overlayfs-based containers without using lxc-start-ephemeral, by using lxc.rootfs = overlayfs:/readonly-dir:writeable-dir 5. add a set of simple clone testcases 6. Write a new lxc_clone.c based on api clone. Still to do (there's more, but off top of my head): 1. support zfs, aufs 2. have clone handle other mount entries (right now it only clones the rootfs) 3. python, lua, and go bindings (not me :) 4. lxc-destroy: if lvm backing store, check for snapshots of it. (what about directories which have overlayfs clones?) Changes since v2: Initialize random generator when picking new macaddr (reported by caglar@10ur.org) Fix wrong use of bitmask flags On copy-clone of btrfs, create a subvolume lxc_clone.c: respect the command line usage of the old script lxc-clone(1): update documentation Refuse to try changing backing stores expect to overlayfs, as it is not implemented (yet) anyway. Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com> Conflicts: src/lxc/utils.h
270 lines
7.2 KiB
Plaintext
270 lines
7.2 KiB
Plaintext
<!--
|
|
|
|
lxc: linux Container library
|
|
|
|
(C) Copyright IBM Corp. 2007, 2008
|
|
|
|
Authors:
|
|
Daniel Lezcano <daniel.lezcano at free.fr>
|
|
Serge Hallyn <serge.hallyn at ubuntu.com>
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with this library; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
-->
|
|
|
|
<!DOCTYPE refentry PUBLIC @docdtd@ [
|
|
|
|
<!ENTITY commonoptions SYSTEM "@builddir@/common_options.sgml">
|
|
<!ENTITY seealso SYSTEM "@builddir@/see_also.sgml">
|
|
]>
|
|
|
|
<refentry>
|
|
|
|
<docinfo><date>@LXC_GENERATE_DATE@</date></docinfo>
|
|
|
|
<refmeta>
|
|
<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="req">-o <replaceable>orig</replaceable></arg>
|
|
<arg choice="req">-n <replaceable>new</replaceable></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="req">orig</arg>
|
|
<arg choice="req">new</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 btrfs, lvm, overlayfs and zfs. LVM devices do not support
|
|
snapshots fo snapshots.
|
|
</para>
|
|
|
|
<para>
|
|
The backing store of the new container will be the same type as the
|
|
original container,
|
|
with one exception: overlayfs snapshots can be created of directory backed
|
|
containers. This can be requested by using 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 should be a LVM or btrfs snapshot of the original.
|
|
</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 tahn
|
|
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>fssize</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>fssize</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>fssize</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
|
|
overlayfs snapshots of directory backed containers. Valid
|
|
backing stores include dir (directory), btrfs, lvm, zfs
|
|
and overlayfs.
|
|
</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>
|
|
|
|
&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:
|
|
-->
|