diff --git a/configure.ac b/configure.ac index c5e6d288f..beb53fe6e 100644 --- a/configure.ac +++ b/configure.ac @@ -680,6 +680,7 @@ AC_CONFIG_FILES([ doc/lxc-clone.sgml doc/lxc-config.sgml doc/lxc-console.sgml + doc/lxc-copy.sgml doc/lxc-create.sgml doc/lxc-destroy.sgml doc/lxc-device.sgml diff --git a/doc/Makefile.am b/doc/Makefile.am index ca69bfa90..f58c240ab 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -24,6 +24,7 @@ man_MANS = \ lxc-clone.1 \ lxc-config.1 \ lxc-console.1 \ + lxc-copy.1 \ lxc-create.1 \ lxc-destroy.1 \ lxc-execute.1 \ diff --git a/doc/lxc-copy.sgml.in b/doc/lxc-copy.sgml.in new file mode 100644 index 000000000..34ebcc5c5 --- /dev/null +++ b/doc/lxc-copy.sgml.in @@ -0,0 +1,291 @@ + + + + +]> + + + + @LXC_GENERATE_DATE@ + + + lxc-copy + 1 + + + + lxc-copy + + + copy an existing container. + + + + + + lxc-copy + -n, --name name + -P, --lxcpath path + -N, --newname newname + -p, --newpath newpath + -B, --backingstorage backingstorage + -s, --snapshot + -K, --keepdata + -M, --keepmac + -L, --fssize size [unit] + + + lxc-copy + -n, --name name + -P, --lxcpath path + -N, --newname newname + -p, --newpath newpath + -e, --ephemeral + -B, --backingstorage backingstorage + -s, --snapshot + -K, --keepdata + -M, --keepmac + -L, --fssize size [unit] + + + lxc-copy + -n, --name name + -P, --lxcpath path + -N, --newname newname + -p, --newpath newpath + -R, --rename + + + + + Description + + + lxc-copy creates and optionally starts (ephemeral or + non-ephemeral) copies of existing containers. It replaces + lxc-clone and lxc-start-ephemeral. + + + lxc-copy 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 aufs, btrfs, lvm (lvm devices + do not support snapshots of snapshots.), overlay, and zfs. + + + + The copy's backing storage will be of the same type as the original + container. aufs or overlayfs snapshots of directory backed containers are + exempted from this rule. + + + + When the -e flag is specified an ephemeral + snapshot of the original container is created and started. Ephemeral + containers will have lxc.ephemeral = 1 set in their + config file and will be destroyed on shutdown. When + -e is used in combination with + -D a non-ephemeral snapshot of the original + container is created and started. + + + When -e is specified and no newname is given via + -N a random name for the snapshot will be chosen. + + + + Containers created and started with -e can have + custom mounts. These are specified with the -m + flag. Currently three types of mounts are supported: + aufs, bind, and + overlay. Mount types are specified as suboptions + to the -m flag and can be specified multiple + times separated by commas. aufs and + overlay mounts are currently specified in the + format -m overlay=/src:/dest. When no + destination dest is specified + dest will be identical to + src. Read-only bind + mounts are specified -m bind=/src:/dest:ro and + read-write bind mounts -m + bind=/src:/dest:rw. Read-write bind + mounts are the default and rw can be missing when + a read-write mount is wanted. When dest is + missing dest will be identical to + src. An example for multiple mounts would be + -m + bind=/src1:/dest1:ro,bind=/src2:ro,overlay=/src3:/dest3. + + + + The mounts, their options, and formats supported via the + -m flag are subject to change. + + + + + + Options + + + + + + + The name for the copy. + + + + + + + The path for the copy. + + + + + + + Rename the original container. + + + + + + + Create a snapshot of the orginal container. The backing + storage for the copy must support snapshots. This currently includes + aufs, btrfs, lvm, overlay, and zfs. + + + + + + + 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 -e.) + + + + + + + + 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 -e.) + + + + + + + + Specify a mount for a snapshot The + opts argument for the mount type can by + of type {aufs, bind, overlay}. For example (This option can + currently only be specified in conjunction with + -e.). + + + + + + + Specify the backing storage type to be used for the copy + where 'backingstorage' is of type 'aufs', 'btrfs', 'dir', 'lvm', 'loop', + 'overlay', or 'zfs'. + + + + + + + Specify the size for an 'lvm' filesystem. + + + + + + + When this option is specified with + -e a non-ephemeral container is created + and started. + + + + + + When this option is specified the hostname of the original + container will be kept for the copy. + + + + + + When this option is specified the MAC address of the original + container will be kept for the copy. + + + + + + + &commonoptions; + + &seealso; + + + Author + Christian Brauner christian.brauner@mailbox.org + + + + + diff --git a/src/lxc/lxc_copy.c b/src/lxc/lxc_copy.c index ac1b051e9..2ce4c9127 100644 --- a/src/lxc/lxc_copy.c +++ b/src/lxc/lxc_copy.c @@ -94,7 +94,7 @@ static char *const keys[] = { static struct lxc_arguments my_args = { .progname = "lxc-copy", - .help = "\ + .help = "\n\ --name=NAME [-P lxcpath] -N newname [-p newpath] [-B backingstorage] [-s] [-K] [-M] [-L size [unit]]\n\ --name=NAME [-P lxcpath] [-N newname] [-p newpath] [-B backingstorage] -e [-d] [-D] [-K] [-M] [-m {bind,aufs,overlay}=/src:/dest]\n\ --name=NAME [-P lxcpath] -N newname -R\n\