Clone a new container from an existing one.
lxc-clone \kx [-s ] [-K ] [-M ] [-H ] [-B backingstore] [-L fssize] [-p lxcpath] [-P newlxcpath] {-o orig} {-n new} [-- hook arguments] lxc-clone \kx [-s ] [-K ] [-M ] [-H ] [-B backingstore] [-L fssize] [-p lxcpath] [-P newlxcpath] {orig} {new} [-- hook arguments]
lxc-clone 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.
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 -B overlayfs arguments.
The names of the original and new container can be given (in that order) after all options, or can be specified with the -o and -n options, respectively.
\*(T<-s, --snapshot\*(T>
The new container's rootfs should be a LVM or btrfs snapshot of the original.
\*(T<-K, --keepname\*(T>
Do not change the hostname of the container (in the root filesystem).
\*(T<-M, --keepmac\*(T>
Use the same MAC address as the original container, rather than generating a new random one.
\*(T<-H, --copyhooks\*(T>
Copy all mount hooks into the new container's directory, and update any lxcpaths and container names as needed.
\*(T<-L, --fssize \*(T>fssize
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.
\*(T<-p, --lxcpath \*(T>lxcpath
The lxcpath of the original container. By default, the system wide configured lxcpath will be used.
\*(T<-P, --newpath \*(T>newlxcpath
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.
\*(T<-B, --backingstore \*(T>backingstore
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.
\*(T<-o, --orig \*(T>orig
The name of the original container to clone.
\*(T<-n, --new \*(T>new
The name of the new container to create.
If the container being cloned has one or more \*(T<lxc.hook.clone\*(T> 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 lxc-clone will be passed to the hook program starting at argument 4. The \*(T<LXC_ROOTFS_MOUNT\*(T> environment variable gives the path under which the container's root filesystem is mounted. The configuration file pathname is stored in \*(T<LXC_CONFIG_FILE\*(T>, the new container name in \*(T<LXC_NAME\*(T>, the old container name in \*(T<LXC_SRC_NAME\*(T>, and the path or device on which the rootfs is located is in \*(T<LXC_ROOTFS_PATH\*(T>.
Serge Hallyn <\*(T<[email protected]\*(T>>