Incremental CT backup to another local disk by copying btrfs subvolume?

Hi,
Still relatively new to LXD and btrfs, I am looking for a way to do incremental backup of my containers to another local drive. Both drives - the LXD storage pool and the backup drive - are using btrfs (as block devices).

With btrfs, we can do incremental backup of one subvolume from one drive to another (see https://btrfs.wiki.kernel.org/index.php/Incremental_Backup ).

If I’m not wrong, when LXD storage pool relies on btrfs, LXD snapshot are based on btrfs subvolume, right? So, could we use in such case the btrfs subvolume incremental backup to perform an incremental backup of the LXD containers from one drive to another?

(note that in my mind, I wish to have both local backup and also a remote backup server, for which I’m using lxc copy. Ideally, lxc copy, when target is another local disk, would perform all the btrfs job mentioned above transparently - if it’s technically possible).

So you could indeed do this only through btrfs behind the scenes, but alternatively you could use the refresh copy feature.

You should be able to do:

  • lxc copy ct1 ct1-backup --refresh --storage other-pool

And for remote:

  • lxc copy ct1 remote:ct1 --refresh

The refresh feature synchronizes the snapshot list between source and destination and then sends whatever changed on the container itself. The initial copy relies on the optimized migration driver, the incremental updates use rsync.