1

btrfs-send has the "-p" parameter to provide the previous snapshot for an incremental backup.

Let's say I have snap1, snap2, snap3 and snap4: then I do a rollback to snap2. If I call btrfs-send now, what's the previous snap? snap1 or snap4?

1 Answer 1

1

Straight from the BTRFS FAQ:

It's easiest to understand if you look at what receive does. Receive takes a stream of instructions, creates a new subvolume, and uses the instructions to modify that subvolume until it looks like the one being sent.

When you use -p, the receiver will take a snapshot of the corresponding subvol, and then use the send stream to modify it.

Generally you can choose any of the subvolumes as the parent. The best parent though would be the one with the fewest differences to the snapshot you want to sent, so in your example this would be snap2.

For btrfs send/receive to work reliably though you should consider these conditions:

  • the subvolume used as parent must exist on the receiver side (identified by the UUID, see BTRFS-send previous snap)
  • the snapshot and the parent need to be related, i.e. either be snapshot of one another or share a common parent
  • both subvolumes need to be read-only (see btrfs property set <subvol> ro true)

You can also omit specifying a parent explicitly and only list subvolumes as clone sources with the -c flag. These also need to exist on the receiving side but btrfs send will try and select the most appropriate parent subvolume for you.

1
  • Extremely clear and useful, thanks a lot. Jan 15, 2021 at 12:29

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.