lxc-copy(1)
π lxc-copy(1) β the manual page bestie π
okay so you're here for lxc-copy(1) and honestly? iconic choice. this little command copies existing containers, and by the end of this page you're gonna understand it fr fr. no cap. let's get into it π
β¨ NAME β¨
lxc-copy β copy an existing container. that's it, that's the vibe. a whole container dupe situation π«Ά
πΈ SYNOPSIS πΈ
okay this is the part where the flags go crazy, so pay attention bestie. there are four whole forms and every flag matters:
lxc-copy {-n, --name name} [-P, --lxcpath path] {-N, --newname newname}
[-p, --newpath newpath] [-B, --backingstorage backingstorage]
[-s, --snapshot] [-a, --allowrunning] [-K, --keepname] [-D,
--keepdata] [-M, --keepmac] [-L, --fssize size [unit]] [-- hook
arguments]
lxc-copy {-n, --name name} [-P, --lxcpath path] [-N, --newname newname]
[-p, --newpath newpath] {-e, --ephemeral} [-B, --backingstorage
backingstorage] [-s, --snapshot] [-a, --allowrunning] [-K,
--keepname] [-D, --keepdata] [-M, --keepmac] [-L, --fssize size
[unit]] [-- hook arguments]
lxc-copy {-n, --name name} [-P, --lxcpath path] [-N, --newname newname]
[-p, --newpath newpath] {-e, --ephemeral} [-B, --backingstorage
backingstorage] [-s, --snapshot] [-t, --tmpfs] [-K, --keepname]
[-M, --keepmac] [-- hook arguments]
lxc-copy {-n, --name name} [-P, --lxcpath path] {-N, --newname newname}
[-p, --newpath newpath] {-R, --rename}
like... yes, it's giving "choose your fighter" energy. pick the form that matches what you're doing and slay π
π DESCRIPTION π
lxc-copy creates and optionally starts (ephemeral or non-ephemeral) copies of existing containers. like, it can make a copy and also launch it? main character energy honestly.
so here's the tea: lxc-copy creates copies of existing containers. those copies can be complete clones of the original β in that case the whole root filesystem of the container is simply copied over to the new container. or they can be snapshots, which are small copy-on-write copies of the original. and if you're going the snapshot route, the specified backing storage for the copy must support snapshots. currently that includes btrfs, lvm (heads up: 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. exception alert π¨: overlay 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. literally here for a good time not a long time π. when -e is used in combination with -D, a non-ephemeral snapshot of the original container is created and started. ephemeral containers can also be placed on a tmpfs with the -t flag. NOTE: if an ephemeral container that is placed on a tmpfs is rebooted, all changes made to it will currently be lost! (yes, lost-lost. gone. poof. π)
when -e is specified and no newname is given via -N, a random name for the snapshot will be chosen. cute surprise name moment π
containers created and started with -e can have custom mounts. these are specified with the -m flag. currently two types of mounts are supported: bind, and overlay. mount types are specified as suboptions to the -m flag and can be specified multiple times separated by commas. 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. ngl, volatility is the vibe here. keep an eye out π
π¦ OPTIONS π¦
okay bestie, here's every single flag. no skipping. we love completeness π
-N,--newnamenewname β the name for the copy. name your new baby πΌ-p,--newpathnewpath β the path for the copy. where it lives π-R,--renameβ rename the original container. not a copy β an actual rename. plot twist.-s,--snapshotβ create a snapshot of the original container. the backing storage for the copy must support snapshots. this currently includesbtrfs,lvm,overlay, andzfs. snapshot slay β¨-a,--allowrunningβ 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. like, actually. be careful bestie π¬-F,--foregroundβ run the snapshot in the foreground. the snapshot's console will be attached to the current tty. (this option can only be specified in conjunction with-e.) front and center energy π-d,--daemonβ 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.) silent but deadly π-m,--mountmounttype β specify a mount for a snapshot. the opts argument for the mount type can be of type{bind, overlay}. for example-m bind=/src:/dest:ro,overlay=/src:/dest. (this option can currently only be specified in conjunction with-e.) mounts on mounts on mounts ποΈ-t,--tmpfsβ when this option is specified, the ephemeral container will be placed on atmpfs. β οΈ NOTE: rebooting an ephemeral container that is located on atmpfswill currently cause all changes made to it to be lost. this flag will only work for ephemeral containers created with the-eflag. the original container, from which the ephemeral snapshot is created, must be stored as a simple directory. tmpfs = temporary fs = temporary vibes π-B,--backingstoragebackingstorage β specify the backing storage type to be used for the copy, wherebackingstorageis of typebtrfs,dir,lvm,loop,overlay, orzfs. pick your storage icon π-L,--fssizesize [unit] β specify the size for anlvmfilesystem. size matters (for lvm, specifically) π-K,--keepnameβ when this option is specified, the hostname of the original container will be kept for the copy. same name, new container, no identity crisis π«Ά-D,--keepdataβ when this option is specified with-e, a non-ephemeral container is created and started. keep the data, keep the vibes πΎ-M,--keepmacβ when this option is specified, the MAC address of the original container will be kept for the copy. MAC address loyalty fr fr π
π COPY HOOK π
if the container being copied has one or more lxc.hook.clone 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 lxc-copy will be passed to the hook program starting at argument 4. the LXC_ROOTFS_MOUNT environment variable gives the path under which the container's root filesystem is mounted. the configuration file pathname is stored in LXC_CONFIG_FILE, the new container name in LXC_NAME, the old container name in LXC_SRC_NAME, and the path or device on which the rootfs is located is in LXC_ROOTFS_PATH.
like... hooks are the backstage pass of container copying. iykyk ποΈ
π COMMON OPTIONS π
these options are common to most of lxc commands. the classics, the staples, the "greatest hits" if you will πΆ
-?,-h,--helpβ print a longer usage message than normal. help a bestie out π--usageβ give the usage message. just the usage. the bare minimum. we respect it.-q,--quietβ mute on. shhh π€«-P,--lxcpath=PATHβ use an alternate container path. the default is/var/lib/lxc. path customization, we love to see it π€οΈ-o,--logfile=FILEβ output to an alternate logFILE. the default is no log. log it or don't, your call π-l,--logpriority=LEVELβ set log priority toLEVEL. the default log priority isERROR. possible values are:FATAL,ALERT,CRIT,WARN,ERROR,NOTICE,INFO,DEBUG,TRACE.
note that this option is setting the priority of the events log in the alternate log file. it do not have effect on the ERROR events log on stderr. (yes, "it do not" β we're quoting the vibe here, no cap. the stderr ERROR log stays unbothered π
)
-n,--name=NAMEβ use container identifierNAME. the container identifier format is an alphanumeric string. names are important, bestie π·οΈ--rcfile=FILEβ specify the configuration file to configure the virtualization and isolation functionalities for the container.
this configuration file, if present, will be used even if there is already a configuration file present in the previously created container (via lxc-create). rcfile said "i'm the captain now" β
--versionβ show the version number. know your version, queen π
β SEE ALSO β
go read these too, bestie β the whole lxc cinematic universe:
lxc(7), lxc-create(1), lxc-copy(1), lxc-destroy(1), lxc-start(1), lxc-stop(1), lxc-execute(1), lxc-console(1), lxc-monitor(1), lxc-wait(1), lxc-cgroup(1), lxc-ls(1), lxc-info(1), lxc-freeze(1), lxc-unfreeze(1), lxc-attach(1), lxc.conf(5)
β¨ and that's the whole manual page, bestie β¨
this lil masterpiece is from 2026-05-01 β dated and everything, periodt. you're officially educated on lxc-copy(1) and honestly? you ate that. go copy some containers responsibly (especially if you're using -a, like, carefully fr fr). mwah ππ«Άπ
π¦ where this page comes from
- alpine 3.24: lxc-doc 7.0.0-r0 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms