On 2020-12-31 08:05, Andrei Borzenkov wrote:
30.12.2020 20:39, john terragon пишет:
On Wed, Dec 30, 2020 at 6:24 PM sys <[email protected]> wrote:



[...]
You should simply make a 'read-write' snapshot (Y-rw) of the 'read-only'
snapshot (Y) that is part of your backup/send scheme. Do not modify
read-only snapshots to be rw.


OK, but then could I use Y as parent of the rw snapshot, let's call it
W, in a send?

No

So I would have this tree where Y is still the root.

Y-W
  \
   Z-X

Can I do a send -p Y W ?

No. All subvolumes used in send/receive must be read-only. And they must
remain read-only from the moment they are created - we have seen quite a
lot of reports when users removed read-only property from subvolume used
in the past as send source, modified it, set as read-only again and
tried to continue replication. This resulted in complete mess on receive
side. Also if you try to modify destination snapshots it will break at
some point.

The general rule - everything used for replication must remain
read-only. If you want to use any snapshot that is part of replication
you clone it and use its clone.

Because I thought it was other way around, that is I do a readonly
snapshot W of Y and that will be the base for incrementally sending
the future modified Y to another  FS (provided of course W is already
there).


If you want to capture changes in W since it was cloned from Y you
create another read-only snapshot of W and use it.

btrfs subvolume snapshot -r W V
btrfs send -p Y V

It is possible that btrfs implementation is optimized for sequential
snapshots from the same subvolume so the send stream size will be
larger. I am not familiar with these low level details. From the naïve
end-user point of view there should be no difference between

btrfs subvolume snapshot -r W R1
btrfs send R1
modify W
btrfs subvolume snapshot -r W R2
btrfs send -p R1 R2

and

btrfs send R1
btrfs subvolume snapshot R1 W
modify W
btrfs subvolume snapshot -r W R2
btrfs send -p R1 R2


I think you are correct. The man page specifies that all snapshots must be read-only, but it is rather unclear if you modify some snaps in between.

https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs-send

Reply via email to