If I send a btrfs incremental stream from drive1 (using -p to refer the last snap) and I receive it on drive2, how does btrfs know which snap on drive2 it should link the stream to (since -p is for the source only, not for the destination)? Does btrfs try to find the same path on the destination or does it try to match it with some more sophisticated logic (for example, matching the ID of the snapshot)?
1 Answer
Matching is done via the subvolume UUID assigned and unique to each subvolume. Additionally subvolumes may have a Parent UUID for the subvolume they are a snapshot of and a Received UUID for the source UUID of subvolumes received via btrfs receive
.
You can see these using btrfs subvolume show <volume>
:
$ btrfs subvolume show /mnt/btrfs/subvolume
/mnt/btrfs/subvolume
Name: subvolume
UUID: 5e076a14-4e42-254d-ac8e-55bebea982d1
Parent UUID: -
Received UUID: -
Creation time: 2018-01-01 12:34:56 +0000
Subvolume ID: 79
Generation: 2844
Gen at creation: 2844
Parent ID: 5
Top level ID: 5
Flags: -
Snapshot(s):
-
Can I safely delete snapshots on the sender (keeping just two of them) without breaking the chain on the receiver? Jan 15, 2021 at 12:32
-
1You only need to keep one suitable snapshot on the sender and receiver side you can then use as the parent for the next send / receive. The shared subvolume is used on the sender side to determine the differences to be sent and on the receiver side it is used as the starting point to apply the changes from the send stream to.– acranJan 15, 2021 at 12:38