3 lxc: linux Container library
5 (C) Copyright Canonical Inc. 2007, 2008
8 Christian Brauner <christian.brauner at mailbox.org>
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 2.1 of the License, or (at your option) any later version.
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public
21 License along with this library; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26 <!DOCTYPE refentry PUBLIC @docdtd@ [
28 <!ENTITY commonoptions SYSTEM "@builddir@/common_options.sgml">
29 <!ENTITY seealso SYSTEM "@builddir@/see_also.sgml">
34 <docinfo><date>@LXC_GENERATE_DATE@</date></docinfo>
37 <refentrytitle>lxc-copy</refentrytitle>
38 <manvolnum>1</manvolnum>
42 <refname>lxc-copy</refname>
45 copy an existing container.
51 <command>lxc-copy</command>
52 <arg choice="req">-n, --name <replaceable>name</replaceable></arg>
53 <arg choice="opt">-P, --lxcpath <replaceable>path</replaceable></arg>
54 <arg choice="req">-N, --newname <replaceable>newname</replaceable></arg>
55 <arg choice="opt">-p, --newpath <replaceable>newpath</replaceable></arg>
56 <arg choice="opt">-B, --backingstorage <replaceable>backingstorage</replaceable></arg>
57 <arg choice="opt">-s, --snapshot</arg>
58 <arg choice="opt">-K, --keepdata</arg>
59 <arg choice="opt">-M, --keepmac</arg>
60 <arg choice="opt">-L, --fssize <replaceable>size [unit]</replaceable></arg>
63 <command>lxc-copy</command>
64 <arg choice="req">-n, --name <replaceable>name</replaceable></arg>
65 <arg choice="opt">-P, --lxcpath <replaceable>path</replaceable></arg>
66 <arg choice="opt">-N, --newname <replaceable>newname</replaceable></arg>
67 <arg choice="opt">-p, --newpath <replaceable>newpath</replaceable></arg>
68 <arg choice="req">-e, --ephemeral</arg>
69 <arg choice="opt">-B, --backingstorage <replaceable>backingstorage</replaceable></arg>
70 <arg choice="opt">-s, --snapshot</arg>
71 <arg choice="opt">-K, --keepdata</arg>
72 <arg choice="opt">-M, --keepmac</arg>
73 <arg choice="opt">-L, --fssize <replaceable>size [unit]</replaceable></arg>
76 <command>lxc-copy</command>
77 <arg choice="req">-n, --name <replaceable>name</replaceable></arg>
78 <arg choice="opt">-P, --lxcpath <replaceable>path</replaceable></arg>
79 <arg choice="req">-N, --newname <replaceable>newname</replaceable></arg>
80 <arg choice="opt">-p, --newpath <replaceable>newpath</replaceable></arg>
81 <arg choice="req">-R, --rename</arg>
86 <title>Description</title>
89 <command>lxc-copy</command> creates and optionally starts (ephemeral or
90 non-ephemeral) copies of existing containers. It replaces
91 <command>lxc-clone</command> and <command>lxc-start-ephemeral</command>.
94 <command>lxc-copy</command> creates copies of existing containers. Copies
95 can be complete clones of the original container. In this case the whole
96 root filesystem of the container is simply copied to the new container. Or
97 they can be snapshots, i.e. small copy-on-write copies of the original
98 container. In this case the specified backing storage for the copy must
99 support snapshots. This currently includes aufs, btrfs, lvm (lvm devices
100 do not support snapshots of snapshots.), overlay, and zfs.
104 The copy's backing storage will be of the same type as the original
105 container. aufs or overlayfs snapshots of directory backed containers are
106 exempted from this rule.
110 When the <replaceable>-e</replaceable> flag is specified an ephemeral
111 snapshot of the original container is created and started. Ephemeral
112 containers will have <command>lxc.ephemeral = 1</command> set in their
113 config file and will be destroyed on shutdown. When
114 <replaceable>-e</replaceable> is used in combination with
115 <replaceable>-D</replaceable> a non-ephemeral snapshot of the original
116 container is created and started.</para>
119 When <replaceable>-e</replaceable> is specified and no newname is given via
120 <replaceable>-N</replaceable> a random name for the snapshot will be chosen.
124 Containers created and started with <replaceable>-e</replaceable> can have
125 custom mounts. These are specified with the <replaceable>-m</replaceable>
126 flag. Currently three types of mounts are supported:
127 <replaceable>aufs</replaceable>, <replaceable>bind</replaceable>, and
128 <replaceable>overlay</replaceable>. Mount types are specified as suboptions
129 to the <replaceable>-m</replaceable> flag and can be specified multiple
130 times separated by commas. <replaceable>aufs</replaceable> and
131 <replaceable>overlay</replaceable> mounts are currently specified in the
132 format <replaceable>-m overlay=/src:/dest</replaceable>. When no
133 destination <replaceable>dest</replaceable> is specified
134 <replaceable>dest</replaceable> will be identical to
135 <replaceable>src</replaceable>. Read-only <replaceable>bind</replaceable>
136 mounts are specified <replaceable>-m bind=/src:/dest:ro</replaceable> and
137 read-write <replaceable>bind</replaceable> mounts <replaceable>-m
138 bind=/src:/dest:rw</replaceable>. Read-write <replaceable>bind</replaceable>
139 mounts are the default and <replaceable>rw</replaceable> can be missing when
140 a read-write mount is wanted. When <replaceable>dest</replaceable> is
141 missing <replaceable>dest</replaceable> will be identical to
142 <replaceable>src</replaceable>. An example for multiple mounts would be
144 bind=/src1:/dest1:ro,bind=/src2:ro,overlay=/src3:/dest3</replaceable>.
148 The mounts, their options, and formats supported via the
149 <replaceable>-m</replaceable> flag are subject to change.
155 <title>Options</title>
160 <term> <option>-N,--newname <replaceable>newname</replaceable></option> </term>
162 <para>The name for the copy.</para>
167 <term> <option>-p,--newpath <replaceable>newpath</replaceable></option> </term>
169 <para>The path for the copy.</para>
174 <term> <option>-R,--rename </option> </term>
176 <para>Rename the original container. </para>
181 <term> <option>-s,--snapshot </option> </term>
183 <para> Create a snapshot of the orginal container. The backing
184 storage for the copy must support snapshots. This currently includes
185 aufs, btrfs, lvm, overlay, and zfs. </para>
190 <term> <option>-F,--foreground</option> </term>
192 <para>Run the snapshot in the foreground. The snapshots console will
193 be attached to the current tty. (This option can only be specified
194 in conjunction with <replaceable>-e</replaceable>.)
200 <term> <option>-d, --daemon</option> </term>
202 <para> Run the snapshot as a daemon (This is the default mode for
203 ephemeral containers.). As the container has no more tty, if an
204 error occurs nothing will be displayed, the log file can
205 be used to check the error. (This option can only be specified in
206 conjunction with <replaceable>-e</replaceable>.)
212 <term> <option>-m, --mount <replaceable>mounttype</replaceable></option> </term>
214 <para> Specify a mount for a snapshot The
215 <replaceable>opts</replaceable> argument for the mount type can by
216 of type {aufs, bind, overlay}. For example <option>-m
217 bind=/src:/dest:ro,overlay=/src:/dest</option> (This option can
218 currently only be specified in conjunction with
219 <replaceable>-e</replaceable>.).</para>
224 <term> <option>-B, --backingstorage <replaceable>backingstorage</replaceable></option></term>
226 <para>Specify the backing storage type to be used for the copy
227 where 'backingstorage' is of type 'aufs', 'btrfs', 'dir', 'lvm', 'loop',
228 'overlay', or 'zfs'. </para>
233 <term> <option>-L, --fssize <replaceable>size [unit]</replaceable></option></term>
235 <para>Specify the size for an 'lvm' filesystem. </para>
240 <term> <option>-D, --keepdata </option></term>
242 <para>When this option is specified with
243 <replaceable>-e</replaceable> a non-ephemeral container is created
244 and started. </para> </listitem>
248 <term> <option>-K, --keepname </option></term>
250 <para> When this option is specified the hostname of the original
251 container will be kept for the copy.</para> </listitem>
255 <term> <option>-M, --keepmac </option></term>
257 <para> When this option is specified the MAC address of the original
258 container will be kept for the copy.</para> </listitem>
270 <title>Author</title>
271 <para>Christian Brauner <email>christian.brauner@mailbox.org</email></para>
276 <!-- Keep this comment at the end of the file
281 sgml-minimize-attributes:nil
282 sgml-always-quote-attributes:t
285 sgml-parent-document:nil
286 sgml-default-dtd-file:nil
287 sgml-exposed-tags:nil
288 sgml-local-catalogs:nil
289 sgml-local-ecat-files:nil