1lxc-copy(1)                                                        lxc-copy(1)
2
3
4

NAME

6       lxc-copy - copy an existing container.
7

SYNOPSIS

9       lxc-copy {-n, --name name} [-P, --lxcpath path] {-N, --newname newname}
10                [-p, --newpath newpath] [-B, --backingstorage backingstorage]
11                [-s, --snapshot] [-K, --keepname] [-D, --keepdata] [-M,
12                --keepmac] [-L, --fssize size [unit]] [-- hook arguments]
13       lxc-copy {-n, --name name} [-P, --lxcpath path] [-N, --newname newname]
14                [-p, --newpath newpath] {-e, --ephemeral} [-B,
15                --backingstorage backingstorage] [-s, --snapshot] [-K,
16                --keepname] [-D, --keepdata] [-M, --keepmac] [-L, --fssize
17                size [unit]] [-- hook arguments]
18       lxc-copy {-n, --name name} [-P, --lxcpath path] [-N, --newname newname]
19                [-p, --newpath newpath] {-e, --ephemeral} [-B,
20                --backingstorage backingstorage] [-s, --snapshot] [-t,
21                --tmpfs] [-K, --keepname] [-M, --keepmac] [-- hook arguments]
22       lxc-copy {-n, --name name} [-P, --lxcpath path] {-N, --newname newname}
23                [-p, --newpath newpath] {-R, --rename}
24

DESCRIPTION

26       lxc-copy creates and optionally  starts  (ephemeral  or  non-ephemeral)
27       copies of existing containers.
28
29       lxc-copy  creates copies of existing containers. Copies can be complete
30       clones of the original container. In this case the whole root  filesys‐
31       tem of the container is simply copied to the new container. Or they can
32       be snapshots, i.e. small copy-on-write copies of the original  contain‐
33       er.  In  this case the specified backing storage for the copy must sup‐
34       port snapshots. This currently includes btrfs, lvm (lvm devices do  not
35       support snapshots of snapshots.), overlay, and zfs.
36
37       The  copy's  backing  storage  will be of the same type as the original
38       container. overlay snapshots of directory backed containers are exempt‐
39       ed from this rule.
40
41       When  the  -e  flag  is specified an ephemeral snapshot of the original
42       container is  created  and  started.  Ephemeral  containers  will  have
43       lxc.ephemeral  =  1  set  in their config file and will be destroyed on
44       shutdown. When -e is used in combination with -D a non-ephemeral  snap‐
45       shot  of the original container is created and started.  Ephemeral con‐
46       tainers can also be placed on  a  tmpfs  with  -t  flag.  NOTE:  If  an
47       ephemeral  container  that is placed on a tmpfs is rebooted all changes
48       made to it will currently be lost!
49
50       When -e is specified and no newname is given via -N a random  name  for
51       the snapshot will be chosen.
52
53       Containers  created  and  started with -e can have custom mounts. These
54       are specified with the -m flag. Currently two types of mounts are  sup‐
55       ported:  bind,  and overlay. Mount types are specified as suboptions to
56       the -m flag and can be specified multiple times  separated  by  commas.
57       overlay   mounts  are  currently  specified  in  the  format  -m  over‐
58       lay=/src:/dest. When no destination dest  is  specified  dest  will  be
59       identical   to   src.   Read-only   bind   mounts   are   specified  -m
60       bind=/src:/dest:ro and read-write bind  mounts  -m  bind=/src:/dest:rw.
61       Read-write  bind  mounts  are  the default and rw can be missing when a
62       read-write mount is wanted. When dest is missing dest will be identical
63       to    src.    An    example   for   multiple   mounts   would   be   -m
64       bind=/src1:/dest1:ro,bind=/src2:ro,overlay=/src3:/dest3.
65
66       The mounts, their options, and formats supported via the  -m  flag  are
67       subject to change.
68

OPTIONS

70       -N,--newname newname
71              The name for the copy.
72
73       -p,--newpath newpath
74              The path for the copy.
75
76       -R,--rename
77              Rename the original container.
78
79       -s,--snapshot
80              Create a snapshot of the original container. The backing storage
81              for the copy must support  snapshots.  This  currently  includes
82              btrfs, lvm, overlay, and zfs.
83
84       -F,--foreground
85              Run  the  snapshot in the foreground. The snapshots console will
86              be attached to the current tty. (This option can only be  speci‐
87              fied in conjunction with -e.)
88
89       -d, --daemon
90              Run  the  snapshot  as  a  daemon  (This is the default mode for
91              ephemeral containers.). As the container has no more tty, if  an
92              error occurs nothing will be displayed, the log file can be used
93              to check the error. (This option can only be specified  in  con‐
94              junction with -e.)
95
96       -m, --mount mounttype
97              Specify  a  mount for a snapshot The opts argument for the mount
98              type  can  by  of  type  {bind,   overlay}.   For   example   -m
99              bind=/src:/dest:ro,overlay=/src:/dest (This option can currently
100              only be specified in conjunction with -e.).
101
102       -t, --tmpfs
103              When this option is specified the ephemeral  container  will  be
104              placed  on  a tmpfs. NOTE: Rebooting an ephemeral container that
105              is located on a tmpfs will currently cause all changes  made  to
106              it to be lost. This flag will only work for ephemeral containers
107              created with the -e flag. The original container, from which the
108              ephemeral snapshot is created, must be stored as a simple direc‐
109              tory.
110
111       -B, --backingstorage backingstorage
112              Specify the backing storage type to be used for the  copy  where
113              'backingstorage'  is  of  type  'btrfs',  'dir',  'lvm', 'loop',
114              'overlay', or 'zfs'.
115
116       -L, --fssize size [unit]
117              Specify the size for an 'lvm' filesystem.
118
119       -K, --keepname
120              When this option is specified the hostname of the original  con‐
121              tainer will be kept for the copy.
122
123       -D, --keepdata
124              When  this option is specified with -e a non-ephemeral container
125              is created and started.
126
127       -M, --keepmac
128              When this option is specified the MAC address  of  the  original
129              container will be kept for the copy.
130

COPY HOOK

132       If the container being copied has one or more lxc.hook.clone specified,
133       then the specified hooks will be called  for  the  new  container.  The
134       first  3 arguments passed to the clone hook will be the container name,
135       a section ('lxc'), and the hook type ('clone'). Extra arguments  passed
136       to  lxc-copy will be passed to the hook program starting at argument 4.
137       The LXC_ROOTFS_MOUNT environment variable gives the  path  under  which
138       the  container's  root  filesystem  is  mounted. The configuration file
139       pathname is stored  in  LXC_CONFIG_FILE,  the  new  container  name  in
140       LXC_NAME,  the  old container name in LXC_SRC_NAME, and the path or de‐
141       vice on which the rootfs is located is in LXC_ROOTFS_PATH.
142

COMMON OPTIONS

144       These options are common to most of lxc commands.
145
146       -?, -h, --help
147              Print a longer usage message than normal.
148
149       --usage
150              Give the usage message
151
152       -q, --quiet
153              mute on
154
155       -P, --lxcpath=PATH
156              Use an alternate container path. The default is /var/lib/lxc.
157
158       -o, --logfile=FILE
159              Output to an alternate log FILE. The default is no log.
160
161       -l, --logpriority=LEVEL
162              Set log priority to LEVEL. The default log  priority  is  ERROR.
163              Possible  values  are  : FATAL, CRIT, WARN, ERROR, NOTICE, INFO,
164              DEBUG.
165
166              Note that this option is setting the priority of the events  log
167              in  the  alternate  log file. It do not have effect on the ERROR
168              events log on stderr.
169
170       -n, --name=NAME
171              Use container identifier NAME.  The container identifier  format
172              is an alphanumeric string.
173
174       --rcfile=FILE
175              Specify  the  configuration file to configure the virtualization
176              and isolation functionalities for the container.
177
178              This configuration file if present will be used even if there is
179              already  a  configuration file present in the previously created
180              container (via lxc-create).
181
182       --version
183              Show the version number.
184

SEE ALSO

186       lxc(7), lxc-create(1), lxc-copy(1), lxc-destroy(1), lxc-start(1),  lxc-
187       stop(1),  lxc-execute(1),  lxc-console(1), lxc-monitor(1), lxc-wait(1),
188       lxc-cgroup(1), lxc-ls(1), lxc-info(1), lxc-freeze(1),  lxc-unfreeze(1),
189       lxc-attach(1), lxc.conf(5)
190

AUTHOR

192       Christian Brauner <christian.brauner@mailbox.org>
193
194
195
196                                  2019-02-01                       lxc-copy(1)
Impressum