Containers backup

Hi all,

I was hoping someone could provide some guidelines
when it comes to backing up /var/lib/lxd
We are using lxd 3.0.3 on an Ubuntu 18.04 virtual machine
with 32 cores and 128GB RAM. It currently hosts 40 containers.
We are using EVault from Carbonite as a backup solution.
It takes almost 24 hours for the backup to complete.
The largest amount of time is spent on processing
of the pool (/var/lib/lxd/lxd.img), it’s a 3.66T file.

Can we separate the backup of /var/lib/lxd
in two jobs, so that the first deals with the pool file
and the other one with the rest?


You may be better off using something that understands ZFS and backs up your zpool instead of the raw lxd.img file as there’s almost no way you’ll be able to back that up without it being inconsistent due to concurrent writes.

And yeah, the rest should be pretty easy to backup, I’d just skip:

  • /var/lib/lxd/disks/
  • /var/lib/lxd/storage-pools/

On the ZFS side of things, I don’t know if there’s something that integrates with Carbonite, but worst case you should be able to script something which uses zfs send to get you a binary file for each dataset including the snapshots which you could then restore by piping into zfs receive should you need to.