From 356231bc2a8bbc640f1375f39f985ec2e6d939e0 Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Sat, 29 Jul 2017 19:03:23 +0200 Subject: [PATCH] btrbk: abort if source subvolume has readonly or received_uuid flag --- ChangeLog | 2 ++ btrbk | 10 ++++++++++ doc/FAQ.md | 18 ++++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6f42d21..d824dab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/btrbk b/btrbk index 590c230..d814836 100755 --- a/btrbk +++ b/btrbk @@ -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 { diff --git a/doc/FAQ.md b/doc/FAQ.md index 8f84b6b..0f62a07 100644 --- a/doc/FAQ.md +++ b/doc/FAQ.md @@ -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.