Re: receive failing for incremental streams
From: Andrei Borzenkov <hidden>
Date: 2021-12-16 05:36:08
On 15.12.2021 23:27, Eric Levy wrote:
Hello. I have been experiencing very confusing problems with incremental streams. For a subvolume, I have a simple incremental backup created from two stages: btrfs send old/@ > base.btrfs btrfs send new/@ -p old/@ > update.btrfs The two source subvolumes are snapshots captured at separate times from the same actively mounted subvolume. On the target, I attempt to restore: btrfs receive ./ < base.btrfs btrfs receive ./ < update.btfs The expectation is that the prior command would create a restored snapshot of the initial backup stage, and that the latter would apply the updated stage. The prior command succeeds, but the latter fails: ERROR: creating snapshot ./@ -> @ failed: File exists
You need to restore it in different directory. Each send stream defines subvolume and you cannot have two subvolumes with the same name in the same directory.
Since it is obvious I cannot usefully apply the second stage to a target that does not exist, I am puzzled about why the process performs this check, as well as what is expected to have success applying the update. How may I apply the update stage to the target generated from restoring the initial stage?
You misunderstand what happens. btrfs receive does not update existing subvlume. It always creates new subvolume by cloning parent replica and applying changes to this clone. Parent remains in its original state and read-only.