]> git.proxmox.com Git - mirror_lxc.git/blame - doc/lxc-clone.sgml.in
licensing: Add missing headers and FSF address
[mirror_lxc.git] / doc / lxc-clone.sgml.in
CommitLineData
11cddd70
SH
1<!--
2
3lxc: linux Container library
4
5(C) Copyright IBM Corp. 2007, 2008
6
7Authors:
9afe19d6 8Daniel Lezcano <daniel.lezcano at free.fr>
11cddd70
SH
9Serge Hallyn <serge.hallyn at ubuntu.com>
10
11This library is free software; you can redistribute it and/or
12modify it under the terms of the GNU Lesser General Public
13License as published by the Free Software Foundation; either
14version 2.1 of the License, or (at your option) any later version.
15
16This library is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19Lesser General Public License for more details.
20
21You should have received a copy of the GNU Lesser General Public
22License along with this library; if not, write to the Free Software
250b1eec 23Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
11cddd70
SH
24
25-->
26
7f951458 27<!DOCTYPE refentry PUBLIC @docdtd@ [
11cddd70
SH
28
29<!ENTITY commonoptions SYSTEM "@builddir@/common_options.sgml">
30<!ENTITY seealso SYSTEM "@builddir@/see_also.sgml">
31]>
32
33<refentry>
34
35 <docinfo><date>@LXC_GENERATE_DATE@</date></docinfo>
36
37 <refmeta>
38 <refentrytitle>lxc-clone</refentrytitle>
39 <manvolnum>1</manvolnum>
40 </refmeta>
41
42 <refnamediv>
43 <refname>lxc-clone</refname>
44
45 <refpurpose>
46 clone a new container from an existing one.
47 </refpurpose>
48 </refnamediv>
49
50 <refsynopsisdiv>
51 <cmdsynopsis>
52 <command>lxc-clone</command>
9be53773
SH
53 <arg choice="opt">-s </arg>
54 <arg choice="opt">-K </arg>
55 <arg choice="opt">-M </arg>
56 <arg choice="opt">-H </arg>
57 <arg choice="opt">-B <replaceable>backingstore</replaceable></arg>
58 <arg choice="opt">-L <replaceable>fssize</replaceable></arg>
59 <arg choice="opt">-p <replaceable>lxcpath</replaceable></arg>
60 <arg choice="opt">-P <replaceable>newlxcpath</replaceable></arg>
11cddd70
SH
61 <arg choice="req">-o <replaceable>orig</replaceable></arg>
62 <arg choice="req">-n <replaceable>new</replaceable></arg>
dc92f6c7 63 <arg choice="opt">-- hook arguments</arg>
9be53773
SH
64 </cmdsynopsis>
65 <cmdsynopsis>
66 <command>lxc-clone</command>
11cddd70 67 <arg choice="opt">-s </arg>
9be53773
SH
68 <arg choice="opt">-K </arg>
69 <arg choice="opt">-M </arg>
70 <arg choice="opt">-H </arg>
71 <arg choice="opt">-B <replaceable>backingstore</replaceable></arg>
11cddd70 72 <arg choice="opt">-L <replaceable>fssize</replaceable></arg>
9be53773
SH
73 <arg choice="opt">-p <replaceable>lxcpath</replaceable></arg>
74 <arg choice="opt">-P <replaceable>newlxcpath</replaceable></arg>
75 <arg choice="req">orig</arg>
76 <arg choice="req">new</arg>
dc92f6c7 77 <arg choice="opt">-- hook arguments</arg>
11cddd70
SH
78 </cmdsynopsis>
79 </refsynopsisdiv>
80
81 <refsect1>
82 <title>Description</title>
83
84 <para>
9be53773
SH
85 <command>lxc-clone</command> Creates a new container as a clone of an existing
86 container. Two types of clones are supported: copy and snapshot. A copy
87 clone copies the root filessytem from the original container to the new. A
88 snapshot filesystem uses the backing store's snapshot functionality to create
89 a very small copy-on-write snapshot of the original container. Snapshot
90 clones require the new container backing store to support snapshotting. Currently
91 this includes only btrfs, lvm, overlayfs and zfs. LVM devices do not support
92 snapshots fo snapshots.
93 </para>
94
95 <para>
96 The backing store of the new container will be the same type as the
97 original container,
98 with one exception: overlayfs snapshots can be created of directory backed
99 containers. This can be requested by using the <replaceable>-B overlayfs</replaceable>
100 arguments.
101 </para>
102
103 <para>
104 The names of the original and new container can be given (in that order)
105 after all options, or can be specified with the
106 <replaceable>-o</replaceable> and <replaceable>-n</replaceable> options,
107 respectively.
11cddd70
SH
108 </para>
109
110 </refsect1>
111
112 <refsect1>
113
114 <title>Options</title>
115
116 <variablelist>
117
118 <varlistentry>
119 <term>
9be53773 120 <option>-s, --snapshot</option>
11cddd70
SH
121 </term>
122 <listitem>
123 <para>
9be53773 124 The new container's rootfs should be a LVM or btrfs snapshot of the original.
11cddd70
SH
125 </para>
126 </listitem>
127 </varlistentry>
128
129 <varlistentry>
130 <term>
9be53773 131 <option>-K, --keepname</option>
11cddd70
SH
132 </term>
133 <listitem>
134 <para>
9be53773
SH
135 Do not change the hostname of the container (in the root
136 filesystem).
11cddd70
SH
137 </para>
138 </listitem>
139 </varlistentry>
140
141 <varlistentry>
142 <term>
9be53773 143 <option>-M, --keepmac</option>
11cddd70
SH
144 </term>
145 <listitem>
146 <para>
9be53773
SH
147 Use the same MAC address as the original container, rather tahn
148 generating a new random one.
149 </para>
150 </listitem>
151 </varlistentry>
152
153 <varlistentry>
154 <term>
155 <option>-H, --copyhooks</option>
156 </term>
157 <listitem>
158 <para>
159 Copy all mount hooks into the new container's directory, and
160 update any lxcpaths and container names as needed.
11cddd70
SH
161 </para>
162 </listitem>
163 </varlistentry>
164
165 <varlistentry>
166 <term>
167 <option>-L, --fssize <replaceable>fssize</replaceable></option>
168 </term>
169 <listitem>
170 <para>
9be53773 171 In the case of a block device backed container, a size for the new
11cddd70
SH
172 block device. By default, the new device will be made the
173 same size as the original.
174 </para>
175 </listitem>
176 </varlistentry>
177
178 <varlistentry>
179 <term>
9be53773 180 <option>-p, --lxcpath <replaceable>fssize</replaceable></option>
11cddd70
SH
181 </term>
182 <listitem>
183 <para>
9be53773
SH
184 The lxcpath of the original container. By default, the system
185 wide configured lxcpath will be used.
11cddd70
SH
186 </para>
187 </listitem>
188 </varlistentry>
189
190 <varlistentry>
191 <term>
9be53773 192 <option>-P, --newpath <replaceable>fssize</replaceable></option>
11cddd70
SH
193 </term>
194 <listitem>
195 <para>
9be53773
SH
196 The lxcpath for the new container. By default the same lxcpath
197 as the original will be used. Note that with btrfs snapshots,
198 changing lxcpaths may not be possible, as subvolume snapshots
199 must be in the same btrfs filesystem.
11cddd70
SH
200 </para>
201 </listitem>
202 </varlistentry>
203
204 <varlistentry>
205 <term>
9be53773 206 <option>-B, --backingstore <replaceable>fssize</replaceable></option>
11cddd70
SH
207 </term>
208 <listitem>
209 <para>
9be53773
SH
210 Select a different backing store for the new container. By
211 default the same as the original container's is used. Note that
212 currently changing the backingstore is only supported for
213 overlayfs snapshots of directory backed containers. Valid
eddaaafd 214 backing stores include dir (directory), btrfs, lvm, zfs, loop
9be53773
SH
215 and overlayfs.
216 </para>
217 </listitem>
218 </varlistentry>
219
220 <varlistentry>
221 <term>
222 <option>-o, --orig <replaceable>orig</replaceable></option>
223 </term>
224 <listitem>
225 <para>
226 The name of the original container to clone.
11cddd70
SH
227 </para>
228 </listitem>
229 </varlistentry>
230
9be53773
SH
231 <varlistentry>
232 <term>
233 <option>-n, --new <replaceable>new</replaceable></option>
234 </term>
235 <listitem>
236 <para>
237 The name of the new container to create.
238 </para>
239 </listitem>
240 </varlistentry>
241
242
11cddd70
SH
243 </variablelist>
244
245 </refsect1>
246
dc92f6c7
SH
247 <refsect1>
248 <title>Clone hook</title>
249 <para>
250 If the container being cloned has one or more <filename>lxc.hook.clone</filename>
251 specified, then the specified hooks will be called for the new container. The
252 first 3 arguments passed to the clone hook will be the container name, a section
253 ('lxc'), and the hook type ('clone'). Extra arguments passed
254 <command>lxc-clone</command> will be passed to the hook program starting at
255 argument 4. The <filename>LXC_ROOTFS_MOUNT</filename> environment variable gives
256 the path under which the container's root filesystem is mounted. The
257 configuration file pathname is stored in <filename>LXC_CONFIG_FILE</filename>, the
1143ed39
DE
258 new container name in <filename>LXC_NAME</filename>, the old container name in
259 <filename>LXC_SRC_NAME</filename>, and the path or device on which
dc92f6c7
SH
260 the rootfs is located is in <filename>LXC_ROOTFS_PATH</filename>.
261 </para>
262 </refsect1>
263
11cddd70
SH
264 &seealso;
265
266 <refsect1>
267 <title>Author</title>
268 <para>Serge Hallyn <email>serge.hallyn@ubuntu.com</email></para>
269 </refsect1>
270
271</refentry>
272
273<!-- Keep this comment at the end of the file
274Local variables:
275mode: sgml
276sgml-omittag:t
277sgml-shorttag:t
278sgml-minimize-attributes:nil
279sgml-always-quote-attributes:t
280sgml-indent-step:2
281sgml-indent-data:t
282sgml-parent-document:nil
283sgml-default-dtd-file:nil
284sgml-exposed-tags:nil
285sgml-local-catalogs:nil
286sgml-local-ecat-files:nil
287End:
288-->