Sorry that this is a recurring subject. The available solutions aren’t good enough for me. Most solutions nowadays suggest lxc export. In my case that won’t work, the containers are way to big for that, there aren’t enough hours in a day.
I want to be able to:
do full and incremental backups
have exclude lists (like the one from rsync and tar)
My containers are in lvm storage. With LXD 3.x I was able to just use the mount point and backup from there. With the new snap LXD that is not possible anymore. The mount points aren’t visible by the native (non-snap) backup user.
What I was thinking was the following.
make a snapshot
mount the snapshot volume (read-only)
backup the mounted snapshot
unmount
remove the snapshot
That seems doable, however the challenge is to know what LVM volume to mount. What is the name of the snapshot volume. Is there a lxc command that could give me that name?
Right now I only can think of this method to find the device to mount. IS there an easier method?
Sorry, I probably should have made a separate post. This post is the first result in Google for “LXD backup LVM”.
What I’m wondering is this: How do I back up files from LXD containers, without using lxc export (which uses way too much CPU + disk IO for daily backups)?
I used to use btrfs and could just back up files directly from /var/snap/lxd/common/lxd/storage-pools/default/containers/foo/rootfs/.... I used these paths with Borgbackup to do daily backups.
I migrated these containers to a system that uses LVM, and the directory under /var/snap/lxd/common/lxd/storage-pools/default/containers/foo/ just appears empty. I guess it’s namespaced or something? Honestly my experience with LVM and LXC/LXD is very limited so there might be something I’m missing.
I didn’t really find anything useful in the documentation about this. I did find this very useful blog post:
which creates a snapshot, mounts it, backs up files from the snapshot, unmounts it, then deletes it. Is that the best approach to take?
Yep that is a fine approach. But keep in mind we do sometimes change the LV name used for containers. Not frequently and no plans currently, but not guaranteed not to change in the future.