I’m currently overhauling our backup concept and that caused a few open questions related to
lxc export. We are on LXD 4.19 with lvm storage backend.
As far as I understand
lxc export is creating a snapshot (not sure?), then it is copying the snapshot into a tar archive below
/var/snap/lxd/common/lxd/backups/ and afterwards optionally (–compression parameter) creating a compressed tar.
Up to 4 backups per instance are kept for 24 hours. ← This could be a bug, when directing lxc export to stdout.
So my plan was to backup large containers. e.g. one with a database and 200GB+ on disk every two hours with
lxc export to a borg backup repository (pipeing the lxc export stdout directly to borg stdin).
Here are my few problems:
- Space: 4 times the container size for the tar archive (+optionally compressed archive)
- Time: The temporary copy can take very long depending on the container size
- Retention: when 4 valid backups are kept, you get an old version if you execute
It would be great if I could just stream the snapshot directly to borg without a temporary copy (and wasteing space). The retention behavoir should be configurable. At least I could not find anything in the docs.
As we are on lvm I already thought of just backing up a volume snapshot. But there is no non-interactive way for the restore (lxd recover is only interactive and lxd import has been removed lately). We’d like to create staging instances from the backups, what cannot be automate this way.