0

Question

Is there a way to synchronize two BTRFS snapshots manually on different disks and mark them as identical (set the parent/child relationship) reliably?

Problem

I was synchronizing my snapshots with my external disk. Naturally, I'm taking advantage of btrfs send -p $PARENT $CURRENT which greatly reduces the amount of data needed to be sent over the wire. To be able to send the snapshot by only using the diff, the PARENT snapshot must exist on both disks.

I mistakenly deleted all of my old snapshots on my laptop so all common snapshots are gone. Since there is no common point, I have to send entire snapshot for the first time, which is about 800GB. rsync says there are only 100MB of difference between my oldest snapshot on my laptop and the newest snapshot on the external disk. That's why I don't want to send whole 800GB again instead of sending 100MB.

Idea

I thought I could

  • create a rw snapshot of oldest snapshot on the external disk (name this foo),
  • use rsync to synchronize foo with the source snapshot on the laptop,
  • then create a readonly snapshot of foo on external disk (foo-readonly),
  • somehow mark foo-readonly's Received UUID with UUID of the source snapshot.

But, since rsync won't synchronize all files (block device files and such), would it break anything in the future if I would keep incremental snapshot technique for the rest of the transfers?

Or ignoring the possible missing files, is there any reliable way to synchronize two snapshots with rsync for this sort of scenario?

  • Try bscp vog.github.io/bscp – Bob Aug 14 '18 at 8:30
  • 2
    Rsync can synchronize block devices via --devices parameter. – Ipor Sircer Aug 14 '18 at 9:53
  • 1
    I discourage using block device synchronization tools, such as those mentioned above, because your source and destination BTRFS filesystems are indeed separate filesystems; even if they share content. If you were to synchronize the filesystems at the block device level, assuming that would work, BTRFS will think both devices are part of the same filesystem. That would be disastrous. See btrfs.wiki.kernel.org/index.php/… – Emmanuel Rosa Aug 15 '18 at 8:20
  • @EmmanuelRosa Your point is accurate. But this block level synchronization will be performed only for the first time. If it works, I think changing UUID of target would resolve the gotcha of the mentioned method. Thanks for reminding. – ceremcem Aug 15 '18 at 9:58

Your Answer

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

Browse other questions tagged or ask your own question.