File: lxc-clone.sgml.in

package info (click to toggle)
lxc 1%3A1.0.6-6%2Bdeb8u2~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 5,280 kB
  • sloc: ansic: 33,888; sh: 11,928; python: 1,223; makefile: 735
file content (288 lines) | stat: -rw-r--r-- 8,531 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
<!--

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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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>
      <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="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 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 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>-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:
-->