fix(backup): carry extended attributes through the restore

A recover mirrored a snapshot with rsync -a, which transfers no extended attributes, so a restored volume came back byte-identical while every application that keeps identity in xattrs read the tree as unknown. OpenCloud posixfs is the case that surfaced it: after the DR drill its storage log reports node.Xattrs on the platform administrator space as no data available, the showcase files are assimilated as new objects, and the graph call that lists drives returns no personal drive, so the design spec dereferences undefined. Measured here, source tagged with user.oc.name, on tmpfs and on ext4 alike: rsync -a returns 0 and drops the attribute, rsync -aHX and rsync -aHAX return 0 and carry it. The shared restore flow and the NFS half of this repo now use -aHAX, the form ensure_subject_subvolume.sh already uses, continuing what 69321d4135 started for numeric ownership.

The backup half still has the same gap: backup-docker-to-local 7.0.2 builds its command as rsync -aP --no-D --delete --delete-excluded with no flag passthrough, so until it carries -X and the pin moves, a snapshot holds no attributes for this restore to put back.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5 committed 2026-10-17 14:16:29 +02:00
1 parent 6c27715d66
commit b033aab42b
11 files changed
+27 -13

No files matched your search

@@ -55,6 +55,20 @@ class TestDirectoryRecovery(unittest.TestCase):
self.assertEqual(text, "from-snapshot")
self.assertFalse((target / "live.txt").exists())
def test_restore_carries_extended_attributes(self) -> None:
with tempfile.TemporaryDirectory() as td:
source, target = self._mk(td)
recovery = _Recovery(str(source), str(target))
with mock.patch("utils.recovery.base.subprocess.run") as run:
recovery.restore()
self.assertEqual(
run.call_args.args[0][:2],
["rsync", "-aHAX"],
"a restore without -X returns the payload byte-identical while "
"every xattr-backed application (OpenCloud posixfs) reads the "
"tree as unknown",
)
def test_missing_unit_refuses(self) -> None:
with tempfile.TemporaryDirectory() as td:
source, target = self._mk(td)