Backup and restore system

I have a lxd server and i have also a storage sever. I need to backup my all containers into my remote storage. If my lxd server down then I want restore all contaner from my storage into a new lxd server. Is it possible? Than how?

The easiest approach is to run LXD on your backup server and use lxc copy --refresh to transfer instances from the live server to the backup server.

If that’s not an option, then you’d need to use the backup API (lxc export) to extract tarballs of each instance and then save that on your backup server, but that’s much more CPU intensive.

1 Like

could u explain more specific, and give proper command? I told that i want to store container backup in my storage server its not another lxd server.

If your not interested in running another LXD server that you can just lxc copy your instances too, you need to run a script, something like the following;

lxc export my_container backup0.tar.gz
rsync backup0.tar.gz your_storage_server/

Advertising: my program can do backups based around the lxc export command.

You would install it either on your remote server and have it download the backups to a specified folder or install it in a container and mount your backup path so my program can see it. (no rsync support)

I saw export file by default stored in LXD server /root path, is there any option to change this location?