1lxc-copy(1) lxc-copy(1)
2
3
4
6 lxc-copy - copy an existing container.
7
9 lxc-copy {-n, --name name} [-P, --lxcpath path] {-N, --newname newname}
10 [-p, --newpath newpath] [-B, --backingstorage backingstorage]
11 [-s, --snapshot] [-a, --allowrunning] [-K, --keepname] [-D,
12 --keepdata] [-M, --keepmac] [-L, --fssize size [unit]] [--
13 hook arguments]
14 lxc-copy {-n, --name name} [-P, --lxcpath path] [-N, --newname newname]
15 [-p, --newpath newpath] {-e, --ephemeral} [-B,
16 --backingstorage backingstorage] [-s, --snapshot] [-a,
17 --allowrunning] [-K, --keepname] [-D, --keepdata] [-M,
18 --keepmac] [-L, --fssize size [unit]] [-- hook arguments]
19 lxc-copy {-n, --name name} [-P, --lxcpath path] [-N, --newname newname]
20 [-p, --newpath newpath] {-e, --ephemeral} [-B,
21 --backingstorage backingstorage] [-s, --snapshot] [-t,
22 --tmpfs] [-K, --keepname] [-M, --keepmac] [-- hook arguments]
23 lxc-copy {-n, --name name} [-P, --lxcpath path] {-N, --newname newname}
24 [-p, --newpath newpath] {-R, --rename}
25
27 lxc-copy creates and optionally starts (ephemeral or non-ephemeral)
28 copies of existing containers.
29
30 lxc-copy creates copies of existing containers. Copies can be complete
31 clones of the original container. In this case the whole root filesys‐
32 tem of the container is simply copied to the new container. Or they can
33 be snapshots, i.e. small copy-on-write copies of the original contain‐
34 er. In this case the specified backing storage for the copy must sup‐
35 port snapshots. This currently includes btrfs, lvm (lvm devices do not
36 support snapshots of snapshots.), overlay, and zfs.
37
38 The copy's backing storage will be of the same type as the original
39 container. overlay snapshots of directory backed containers are exempt‐
40 ed from this rule.
41
42 When the -e flag is specified an ephemeral snapshot of the original
43 container is created and started. Ephemeral containers will have
44 lxc.ephemeral = 1 set in their config file and will be destroyed on
45 shutdown. When -e is used in combination with -D a non-ephemeral snap‐
46 shot of the original container is created and started. Ephemeral con‐
47 tainers can also be placed on a tmpfs with -t flag. NOTE: If an
48 ephemeral container that is placed on a tmpfs is rebooted all changes
49 made to it will currently be lost!
50
51 When -e is specified and no newname is given via -N a random name for
52 the snapshot will be chosen.
53
54 Containers created and started with -e can have custom mounts. These
55 are specified with the -m flag. Currently two types of mounts are sup‐
56 ported: bind, and overlay. Mount types are specified as suboptions to
57 the -m flag and can be specified multiple times separated by commas.
58 overlay mounts are currently specified in the format -m over‐
59 lay=/src:/dest. When no destination dest is specified dest will be
60 identical to src. Read-only bind mounts are specified -m
61 bind=/src:/dest:ro and read-write bind mounts -m bind=/src:/dest:rw.
62 Read-write bind mounts are the default and rw can be missing when a
63 read-write mount is wanted. When dest is missing dest will be identical
64 to src. An example for multiple mounts would be -m
65 bind=/src1:/dest1:ro,bind=/src2:ro,overlay=/src3:/dest3.
66
67 The mounts, their options, and formats supported via the -m flag are
68 subject to change.
69
71 -N,--newname newname
72 The name for the copy.
73
74 -p,--newpath newpath
75 The path for the copy.
76
77 -R,--rename
78 Rename the original container.
79
80 -s,--snapshot
81 Create a snapshot of the original container. The backing storage
82 for the copy must support snapshots. This currently includes
83 btrfs, lvm, overlay, and zfs.
84
85 -a,--allowrunning
86 Allow the creation of a Snapshot of an already running contain‐
87 er. This may cause data corruption or data loss depending on
88 the used filesystem and applications. Use with care.
89
90 -F,--foreground
91 Run the snapshot in the foreground. The snapshots console will
92 be attached to the current tty. (This option can only be speci‐
93 fied in conjunction with -e.)
94
95 -d, --daemon
96 Run the snapshot as a daemon (This is the default mode for
97 ephemeral containers.). As the container has no more tty, if an
98 error occurs nothing will be displayed, the log file can be used
99 to check the error. (This option can only be specified in con‐
100 junction with -e.)
101
102 -m, --mount mounttype
103 Specify a mount for a snapshot The opts argument for the mount
104 type can by of type {bind, overlay}. For example -m
105 bind=/src:/dest:ro,overlay=/src:/dest (This option can currently
106 only be specified in conjunction with -e.).
107
108 -t, --tmpfs
109 When this option is specified the ephemeral container will be
110 placed on a tmpfs. NOTE: Rebooting an ephemeral container that
111 is located on a tmpfs will currently cause all changes made to
112 it to be lost. This flag will only work for ephemeral containers
113 created with the -e flag. The original container, from which the
114 ephemeral snapshot is created, must be stored as a simple direc‐
115 tory.
116
117 -B, --backingstorage backingstorage
118 Specify the backing storage type to be used for the copy where
119 'backingstorage' is of type 'btrfs', 'dir', 'lvm', 'loop',
120 'overlay', or 'zfs'.
121
122 -L, --fssize size [unit]
123 Specify the size for an 'lvm' filesystem.
124
125 -K, --keepname
126 When this option is specified the hostname of the original con‐
127 tainer will be kept for the copy.
128
129 -D, --keepdata
130 When this option is specified with -e a non-ephemeral container
131 is created and started.
132
133 -M, --keepmac
134 When this option is specified the MAC address of the original
135 container will be kept for the copy.
136
138 If the container being copied has one or more lxc.hook.clone specified,
139 then the specified hooks will be called for the new container. The
140 first 3 arguments passed to the clone hook will be the container name,
141 a section ('lxc'), and the hook type ('clone'). Extra arguments passed
142 to lxc-copy will be passed to the hook program starting at argument 4.
143 The LXC_ROOTFS_MOUNT environment variable gives the path under which
144 the container's root filesystem is mounted. The configuration file
145 pathname is stored in LXC_CONFIG_FILE, the new container name in
146 LXC_NAME, the old container name in LXC_SRC_NAME, and the path or de‐
147 vice on which the rootfs is located is in LXC_ROOTFS_PATH.
148
150 These options are common to most of lxc commands.
151
152 -?, -h, --help
153 Print a longer usage message than normal.
154
155 --usage
156 Give the usage message
157
158 -q, --quiet
159 mute on
160
161 -P, --lxcpath=PATH
162 Use an alternate container path. The default is /var/lib/lxc.
163
164 -o, --logfile=FILE
165 Output to an alternate log FILE. The default is no log.
166
167 -l, --logpriority=LEVEL
168 Set log priority to LEVEL. The default log priority is ERROR.
169 Possible values are : FATAL, CRIT, WARN, ERROR, NOTICE, INFO,
170 DEBUG.
171
172 Note that this option is setting the priority of the events log
173 in the alternate log file. It do not have effect on the ERROR
174 events log on stderr.
175
176 -n, --name=NAME
177 Use container identifier NAME. The container identifier format
178 is an alphanumeric string.
179
180 --rcfile=FILE
181 Specify the configuration file to configure the virtualization
182 and isolation functionalities for the container.
183
184 This configuration file if present will be used even if there is
185 already a configuration file present in the previously created
186 container (via lxc-create).
187
188 --version
189 Show the version number.
190
192 lxc(7), lxc-create(1), lxc-copy(1), lxc-destroy(1), lxc-start(1), lxc-
193 stop(1), lxc-execute(1), lxc-console(1), lxc-monitor(1), lxc-wait(1),
194 lxc-cgroup(1), lxc-ls(1), lxc-info(1), lxc-freeze(1), lxc-unfreeze(1),
195 lxc-attach(1), lxc.conf(5)
196
198 Christian Brauner <christian.brauner@mailbox.org>
199
200
201
202 2021-01-18 lxc-copy(1)