btrbk: abort if source subvolume has readonly or received_uuid flag

pull/175/head
Axel Burri 2017-07-29 19:03:23 +02:00
parent 59cc728d90
commit 356231bc2a
3 changed files with 30 additions and 0 deletions

View File

@ -5,6 +5,8 @@ btrbk-current
and "lockfile" configuration options.
* Show "up-to-date" status for backups in "stats" command.
* Show "correlated" status instead of "orphaned" in "stats" command.
* Check source subvolumes for readonly and received_uuid flags, and
abort if one of them is set.
btrbk-0.25.0

10
btrbk
View File

@ -4534,6 +4534,16 @@ MAIN:
WARN "Skipping subvolume \"$svol->{PRINT}\": $abrt";
next;
}
if($svol->{node}{readonly}) {
ABORTED($svol, "subvolume is readonly");
WARN "Skipping subvolume \"$svol->{PRINT}\": $abrt";
next;
}
if($svol->{node}{received_uuid} ne '-') {
ABORTED($svol, "\"Received UUID\" is set");
WARN "Skipping subvolume \"$svol->{PRINT}\": $abrt";
next;
}
if($svol->{node}{uuid} && _is_child_of($sroot->{node}, $svol->{node}{uuid})) {
DEBUG "Found \"$svol->{PRINT}\" (id=$svol->{node}{id}) in btrfs subtree of: $sroot->{PRINT}";
} else {

View File

@ -260,3 +260,21 @@ This approach has the advantage that you don't need to reformat your
USB disk. This works fine, but be aware that you may run into trouble
if a single stream gets corrupted, making all subsequent streams
unusable.
I'm getting an error: Aborted: "Received UUID" is set
-----------------------------------------------------
You probably restored a backup with send-receive, and made it
read/write using `btrfs property set`. This is bad, as all snapshots
and backups will inherit this identical "Received UUID", which results
in all these subvolumes will be treated as "containing same data".
To fix this, create a "proper" snapshot:
# cd /mnt/btr_pool
# mv mysubvolume mysubvolume.broken
# btrfs subvolume snapshot mysubvolume.broken mysubvolume
Now, `mysubvolume` should have an empty "Received UUID", and btrbk
will not complain any more.