aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-10-04 06:02:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-10-04 06:10:57 +0200
commita22c237897a5fee1e32b52251d5a324248dc41f8 (patch)
tree69b28f2b4b31b74c243f1316f06c216a88cf06f9
parent224f5cc31e75eb072faffc3d313252cdb80cb05d (diff)
Add -f (force) flag to `btrfs property set ro false` in upload-machine
Recent btrfs-progs require the force flag (-f) (Debian bug #1019377). Turns out btrfs now strips the subvolume uuid if we make it rw, which will prevent it from being used as a base for incremental send.
-rwxr-xr-xupload-machine12
1 files changed, 10 insertions, 2 deletions
diff --git a/upload-machine b/upload-machine
index 5d4e6b7..b726429 100755
--- a/upload-machine
+++ b/upload-machine
@@ -103,7 +103,7 @@ fi
# btrfs send command
#
-send=(sudo btrfs send)
+send=(btrfs send)
if [ -n "$oldsv" ]; then
send+=(-p "$oldsv")
fi
@@ -121,7 +121,15 @@ sudo "${send[@]}" | ssh "$host" sudo btrfs receive "$machines/$mname/"
# Adjust machine ownership.
#
-ssh "$host" sudo btrfs property set -ts "$newsv_host" ro false
+# Recent btrfs-progs require the force flag (-f) (Debian bug #1019377).
+# Turns out btrfs now strips the subvolume uuid if we make it rw, which
+# will prevent it from being used as a base for incremental send.
+#
+# @@ Maybe we should just keep the original as is (for incremental send)
+# and make another copy where we change the ownership? Note: will also
+# need to update remove-machine.
+#
+ssh "$host" sudo btrfs property set -f -ts "$newsv_host" ro false
ssh "$host" sudo chown "$user:$user" "$newsv_host"
ssh "$host" sudo chown "$user:$user" "$newsv_host/*"
ssh "$host" btrfs property set -ts "$newsv_host" ro true