File: lxc-copy.sgml.in

package info (click to toggle)
lxc 1%3A6.0.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,808 kB
  • sloc: ansic: 68,840; sh: 4,266; python: 135; makefile: 59
file content (328 lines) | stat: -rw-r--r-- 12,933 bytes parent folder | download | duplicates (2)
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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
<!-- SPDX-License-Identifier: LGPL-2.1+ -->

<!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-copy</refentrytitle>
    <manvolnum>1</manvolnum>
  </refmeta>

  <refnamediv>
    <refname>lxc-copy</refname>

    <refpurpose>
      copy an existing container.
    </refpurpose>
  </refnamediv>

  <refsynopsisdiv>
    <cmdsynopsis>
      <command>lxc-copy</command>
      <arg choice="req">-n, --name <replaceable>name</replaceable></arg>
      <arg choice="opt">-P, --lxcpath <replaceable>path</replaceable></arg>
      <arg choice="req">-N, --newname <replaceable>newname</replaceable></arg>
      <arg choice="opt">-p, --newpath <replaceable>newpath</replaceable></arg>
      <arg choice="opt">-B, --backingstorage <replaceable>backingstorage</replaceable></arg>
      <arg choice="opt">-s, --snapshot</arg>
      <arg choice="opt">-a, --allowrunning</arg>
      <arg choice="opt">-K, --keepname</arg>
      <arg choice="opt">-D, --keepdata</arg>
      <arg choice="opt">-M, --keepmac</arg>
      <arg choice="opt">-L, --fssize <replaceable>size [unit]</replaceable></arg>
      <arg choice="opt">-- hook arguments</arg>
    </cmdsynopsis>
    <cmdsynopsis>
      <command>lxc-copy</command>
      <arg choice="req">-n, --name <replaceable>name</replaceable></arg>
      <arg choice="opt">-P, --lxcpath <replaceable>path</replaceable></arg>
      <arg choice="opt">-N, --newname <replaceable>newname</replaceable></arg>
      <arg choice="opt">-p, --newpath <replaceable>newpath</replaceable></arg>
      <arg choice="req">-e, --ephemeral</arg>
      <arg choice="opt">-B, --backingstorage <replaceable>backingstorage</replaceable></arg>
      <arg choice="opt">-s, --snapshot</arg>
      <arg choice="opt">-a, --allowrunning</arg>
      <arg choice="opt">-K, --keepname</arg>
      <arg choice="opt">-D, --keepdata</arg>
      <arg choice="opt">-M, --keepmac</arg>
      <arg choice="opt">-L, --fssize <replaceable>size [unit]</replaceable></arg>
      <arg choice="opt">-- hook arguments</arg>
    </cmdsynopsis>
    <cmdsynopsis>
      <command>lxc-copy</command>
      <arg choice="req">-n, --name <replaceable>name</replaceable></arg>
      <arg choice="opt">-P, --lxcpath <replaceable>path</replaceable></arg>
      <arg choice="opt">-N, --newname <replaceable>newname</replaceable></arg>
      <arg choice="opt">-p, --newpath <replaceable>newpath</replaceable></arg>
      <arg choice="req">-e, --ephemeral</arg>
      <arg choice="opt">-B, --backingstorage <replaceable>backingstorage</replaceable></arg>
      <arg choice="opt">-s, --snapshot</arg>
      <arg choice="opt">-t, --tmpfs</arg>
      <arg choice="opt">-K, --keepname</arg>
      <arg choice="opt">-M, --keepmac</arg>
      <arg choice="opt">-- hook arguments</arg>
    </cmdsynopsis>
    <cmdsynopsis>
      <command>lxc-copy</command>
      <arg choice="req">-n, --name <replaceable>name</replaceable></arg>
      <arg choice="opt">-P, --lxcpath <replaceable>path</replaceable></arg>
      <arg choice="req">-N, --newname <replaceable>newname</replaceable></arg>
      <arg choice="opt">-p, --newpath <replaceable>newpath</replaceable></arg>
      <arg choice="req">-R, --rename</arg>
    </cmdsynopsis>
  </refsynopsisdiv>

  <refsect1>
    <title>Description</title>

    <para>
      <command>lxc-copy</command> creates and optionally starts (ephemeral or
      non-ephemeral) copies of existing containers.
    </para>
    <para>
      <command>lxc-copy</command> creates copies of existing containers. Copies
      can be complete clones of the original container. In this case the whole
      root filesystem of the container is simply copied to the new container. Or
      they can be snapshots, i.e. small copy-on-write copies of the original
      container. In this case the specified backing storage for the copy must
      support snapshots. This currently includes btrfs, lvm (lvm devices
      do not support snapshots of snapshots.), overlay, and zfs.
    </para>
      
    <para>
    The copy's backing storage will be of the same type as the original
    container. overlay snapshots of directory backed containers are
    exempted from this rule.
    </para>

    <para>
    When the <replaceable>-e</replaceable> flag is specified an ephemeral
    snapshot of the original container is created and started. Ephemeral
    containers will have <command>lxc.ephemeral = 1</command> set in their
    config file and will be destroyed on shutdown. When
    <replaceable>-e</replaceable> is used in combination with
    <replaceable>-D</replaceable> a non-ephemeral snapshot of the original
    container is created and started.
    Ephemeral containers can also be placed on a tmpfs with <replaceable>-t</replaceable>
    flag. NOTE: If an ephemeral container that is placed on a tmpfs is rebooted
    all changes made to it will currently be lost!
    </para>

    <para>
    When <replaceable>-e</replaceable> is specified and no newname is given via
    <replaceable>-N</replaceable> a random name for the snapshot will be chosen.
    </para>

    <para>
    Containers created and started with <replaceable>-e</replaceable> can have
    custom mounts. These are specified with the <replaceable>-m</replaceable>
    flag. Currently two types of mounts are supported:
    <replaceable>bind</replaceable>, and
    <replaceable>overlay</replaceable>. Mount types are specified as suboptions
    to the <replaceable>-m</replaceable> flag and can be specified multiple
    times separated by commas. <replaceable>overlay</replaceable> mounts are
    currently specified in the format <replaceable>-m
    overlay=/src:/dest</replaceable>.  When no destination
    <replaceable>dest</replaceable> is specified
    <replaceable>dest</replaceable> will be identical to
    <replaceable>src</replaceable>. Read-only <replaceable>bind</replaceable>
    mounts are specified <replaceable>-m bind=/src:/dest:ro</replaceable> and
    read-write <replaceable>bind</replaceable> mounts <replaceable>-m
    bind=/src:/dest:rw</replaceable>. Read-write
    <replaceable>bind</replaceable> mounts are the default and
    <replaceable>rw</replaceable> can be missing when a read-write mount is
    wanted. When <replaceable>dest</replaceable> is missing
    <replaceable>dest</replaceable> will be identical to
    <replaceable>src</replaceable>. An example for multiple mounts would be
    <replaceable>-m
    bind=/src1:/dest1:ro,bind=/src2:ro,overlay=/src3:/dest3</replaceable>.
    </para>

    <para>
    The mounts, their options, and formats supported via the
    <replaceable>-m</replaceable> flag are subject to change.
    </para>
  </refsect1>

  <refsect1>

    <title>Options</title>

    <variablelist>

	  <varlistentry>
	    <term> <option>-N,--newname <replaceable>newname</replaceable></option> </term>
	   <listitem>
	    <para>The name for the copy.</para>
	   </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term> <option>-p,--newpath <replaceable>newpath</replaceable></option> </term>
	   <listitem>
	    <para>The path for the copy.</para>
	   </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term> <option>-R,--rename </option> </term>
	   <listitem>
	    <para>Rename the original container. </para>
	   </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term> <option>-s,--snapshot </option> </term>
	   <listitem>
            <para> Create a snapshot of the original container. The backing
            storage for the copy must support snapshots. This currently includes
            btrfs, lvm, overlay, and zfs. </para>
	   </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term> <option>-a,--allowrunning </option> </term>
	   <listitem>
	    <para> Allow the creation of a Snapshot of an already running container.
	    This may cause data corruption or data loss depending on the used
	    filesystem and applications. Use with care. </para>
	   </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term> <option>-F,--foreground</option> </term>
	   <listitem>
            <para>Run the snapshot in the foreground. The snapshots console will
            be attached to the current tty. (This option can only be specified
            in conjunction with <replaceable>-e</replaceable>.)
            </para>
	   </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term> <option>-d, --daemon</option> </term>
	   <listitem>
            <para> Run the snapshot as a daemon (This is the default mode for
            ephemeral containers.). As the container has no more tty, if an
            error occurs nothing will be displayed, the log file can
            be used to check the error. (This option can only be specified in
            conjunction with <replaceable>-e</replaceable>.)
            </para>
	   </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term> <option>-m, --mount <replaceable>mounttype</replaceable></option> </term>
	   <listitem>
            <para>  Specify a mount for a snapshot  The
            <replaceable>opts</replaceable> argument for the mount type can by
            of type {bind, overlay}. For example <option>-m
            bind=/src:/dest:ro,overlay=/src:/dest</option> (This option can
            currently only be specified in conjunction with
            <replaceable>-e</replaceable>.).</para>
	   </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term> <option>-t, --tmpfs </option></term>
	   <listitem>
            <para> When this option is specified the ephemeral container will be
            placed on a tmpfs. NOTE: Rebooting an ephemeral container that is
            located on a tmpfs will currently cause all changes made to it to be
            lost. This flag will only work for ephemeral containers created with
            the <replaceable>-e</replaceable> flag. The original container, from
            which the ephemeral snapshot is created, must be stored as a simple
            directory.
            </para> </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term> <option>-B, --backingstorage <replaceable>backingstorage</replaceable></option></term>
	   <listitem>
            <para>Specify the backing storage type to be used for the copy
            where 'backingstorage' is of type 'btrfs', 'dir', 'lvm', 'loop',
            'overlay', or 'zfs'. </para>
	   </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term> <option>-L, --fssize <replaceable>size [unit]</replaceable></option></term>
	   <listitem>
            <para>Specify the size for an 'lvm' filesystem. </para>
	   </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term> <option>-K, --keepname </option></term>
	   <listitem>
            <para> When this option is specified the hostname of the original
            container will be kept for the copy.</para> </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term> <option>-D, --keepdata </option></term>
	   <listitem>
            <para>When this option is specified with
            <replaceable>-e</replaceable> a non-ephemeral container is created
            and started. </para> </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term> <option>-M, --keepmac </option></term>
	   <listitem>
            <para> When this option is specified the MAC address of the original
            container will be kept for the copy.</para> </listitem>
	  </varlistentry>

    </variablelist>

  </refsect1>

  <refsect1>
    <title>Copy hook</title>
    <para>
      If the container being copied 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 to <command>lxc-copy</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>

  &commonoptions;

  &seealso;

</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:
-->