diff --git a/src/baudolo/backup/volume.py b/src/baudolo/backup/volume.py index 5500e94..632a3af 100644 --- a/src/baudolo/backup/volume.py +++ b/src/baudolo/backup/volume.py @@ -75,7 +75,7 @@ def backup_volume( pathlib.Path(dest).mkdir(parents=True, exist_ok=True) last = get_last_backup_dir(versions_dir, volume_name, dest) - cmd = ["rsync", "-aP", "--no-D", "--delete", "--delete-excluded"] + cmd = ["rsync", "-aHAX", "-P", "--no-D", "--delete", "--delete-excluded"] if authoritative: cmd.append("--checksum") if last: diff --git a/src/baudolo/restore/files.py b/src/baudolo/restore/files.py index ff05112..3adc13a 100644 --- a/src/baudolo/restore/files.py +++ b/src/baudolo/restore/files.py @@ -59,6 +59,6 @@ def restore_volume_files(volume_name: str, backup_files_dir: str) -> int: # rsync reads "dir/" as its contents and "dir" as the directory itself. src = f"{Path(backup_files_dir)}{os.sep}" dest = f"{Path(mountpoint)}{os.sep}" - run(["rsync", "-avv", "--delete", src, dest]) + run(["rsync", "-aHAX", "-vv", "--delete", src, dest]) print("File restore complete.") return 0 diff --git a/tests/unit/backup/test_volume.py b/tests/unit/backup/test_volume.py index 4efe29b..1c69790 100644 --- a/tests/unit/backup/test_volume.py +++ b/tests/unit/backup/test_volume.py @@ -46,9 +46,12 @@ class TestBackupVolume(unittest.TestCase): def test_it_carries_no_kernel_objects_into_a_generation(self) -> None: self.assertIn("--no-D", self.copy()) + def test_it_stores_the_metadata_a_restore_has_to_give_back(self) -> None: + self.assertIn("-aHAX", self.copy()) + def test_it_keeps_no_twin_of_what_the_second_pass_replaces(self) -> None: command = self.copy(authoritative=True) - self.assertEqual(command[:2], ["rsync", "-aP"]) + self.assertEqual(command[:3], ["rsync", "-aHAX", "-P"]) self.assertNotIn("--backup", command) def test_it_creates_the_destination(self) -> None: