Backup LXC container


(gery escalier) #1

good to all friends, I have the following problem, I have Debian 9 as the main distro there I have my server LXC, in this LXC I have created a container with Debian 9 and some services that I have already configured and I do not want to lose these configurations.

The problem is that I’m going to restore my main distro by default and I want to back the container that I have with all my configurations

How can I create a copy of my container so I can later use it without losing my settings?
If I use command
lxc-copy -n debian9 -N debian9a
Will you completely copy the container without affecting my settings?

Regards!! :grinning::beers:


(Stéphane Graber) #2

lxc-copy will keep the entirety of your container’s rootfs so your service will be fine.

But it sounds like you’re reinstalling the host rather than the container, in which case you’re probably looking at backuping up /var/lib/lxc (tarball or rsync) and restoring it post-reinstall instead.


(gery escalier) #3

Hello @stgraber thank you very much for your answer, it is correct what I must do is a backup.
Thank you very much for the help.
Regards!! :grinning::beers: