Although it’s officially supported, there really isn’t much documentation around for LXD on LVM, and many LXD built-in commands don’t seem to work with LVM as a storage backend. Currently, I’m trying to figure out how to best proceed to backup and, in the event of a disaster, restore my containers.
I understand there probably not the one solution for this. My primary goal is to minimize time (and complexity) to restore.
The official documentation says that in order to do a full backup, the entirety of
/var/lib/lxd should be backed up, as well as the LVM volume group holding the container volumes. I’m trying to make sense of that statement.
Clearly, the content of
/var/lib/lxd changes considerably depending on whether the containers are started or not. If they are started, their volumes will be mounted to
/var/lib/lxd/storage-pools. If you were to back up that folder but also the whole volumes, you’d back up the same twice. So what is exactly meant here? Really back up all the data in
/var/lib/lxd and just back up the meta data for the LVM volume group, or backup
/var/lib/lxd without the mounted storage-pools and make a full backup of the LVM groups and volumes?
As a follow up to that question, let’s assume for a second that I cannot recreate the exact same PV/VG, I lost or discarded the meta data to do so. Instead, I switch to a new machine, set up a new PV/VG (e.g. on a bigger and better disk) but I recreate a thin pool with the same name and recreate the same volumes using backups. How would I tell LXD where to find the storage for its containers?
And any other advice you can share on this topic would be highly appreciated.