[lxc-users] lxc archive / lxc restore command?
Micky Del Favero
micky at mesina.net
Thu Apr 13 12:48:45 UTC 2017
Tomasz Chmielewski <mangoo at wpkg.org> writes:
> In other words - how to best achieve:
>
> - tar a selected container
>
> - copy it via SSH somewhere
>
> - restore at some later point in time somewhere else, on a different,
> unrelated LXD server
Probably it's not the best way to do it, but you can create an
image starting from the container to be archive, export it to a tar
archive and then destroy the image:
$ lxc publish $container --alias $container
$ lxc image export $container
$ lxc image delete $container
to restore it do the opposite:
$ lxc image import $container.tar.gz
$ lxc init $container $container
$ lxc image delete $container
creating an image require to stop the container, so you cannot do it on
the fly.
In a simpler and faster (at least for me) way I achieve this goal simply
do manually a tar of /var/lib/lxd/containers/$container, when I'll need
to restore it I'll init a simple container: lxc init $smallimage
$container and then overwrite it with previously tarred container.
If container's filesystem is in a LV volume mount it somewhere and then
using tar on it, or snapshot the LV and then archive the snapshot.
Ciao, Micky
--
The sysadmin has all the answers, expecially "No"
More information about the lxc-users
mailing list