1

there are several articles and tools on the web on differential syncing of snapshots with btrfs.

my question here concerns the bootstrapping of the incremental process.

i am able to start the incremental backup of snapshots when i set up the backup directory using something like

(src)$ sudo btrfs send initial_snapshot -f somedir/initial_snapshot.data"
(dst)$ sudo btrfs receive initial_snapshot -f somedir/initial_snapshot.data"

(assuming src and dst are on different block devices or even on different machines).

is there a way to start off with subvolumes that are synchronized with rsync? i.e. can i bootstrap the differential sync that way?

if i do this in a naive way (having src and dst synced with rsync and creating a read-only snapshot on each) i get the following error:

btrfs error: can not find parent snapshot

and yes, that is understandable.

but is there a way to 'convince' btrfs that src and dst contain the same data and that the initial_snapshot can be used as the parent for the incremental snapshot?

2

Unfortunately you can't bootstrap this with anything but a send/receive operation. Incremental transfers with send/receive are dependent on two things:

  1. The 'Received UUID' attributes of the relevant subvolume son the destination volume have to correctly match the 'UUID' attribute of the corresponding subvolumes on the source. You can easily check this with the btrfs subvolume show command, but there is no way to set these values short of directly modifying these values.
  2. The blocks in the parent subvolume used for the incremental send must match between the source and destination. In other words, if you're sending an incremental update that has changes in file X, then the copy of the previous version of file X on the destination volume has to be identical to the original copy of file X on the source volume. Strictly speaking, rsync should technically meet this requirement if you have no reflinks involved other than those across snapshots (that is, nothing has ever used the CLONE_RANGE or EXTENT_SAME ioctls on anything inside the parent subvolume for the source snapshot).

In theory, it is actually possible to work around both constraints, but doing so takes significant effort and requires very low-level knowledge of BTRFS (and is extremely risky).

  • thanks for your answer! i fear you are right but am a bit reluctant to accept it - in the hope that (maybe with a later version of btrfs?) there will be a simple way (hopefully a normal userland tool) that will allow for this use-case. re-read my comment: that is no reason not to accept your answer! thanks again! – hiro protagonist Jan 18 '18 at 10:53
  • @hiroprotagonist I pretty seriously doubt that any way to do this without send/receive will ever be made. It's far more likely that it will become far more efficient to bootstrap things through send/receive. I'm still hoping that native support for compressed send streams gets added, which would help significantly if your source and destination volumes are on different systems. – Austin Hemmelgarn Jan 18 '18 at 15:21
  • i asked the very same question over on askubuntu.com. in case you care: feel free to post your answer over there as well - would be just for completeness... – hiro protagonist Jan 20 '18 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.