Add remote verify script

This commit is contained in:
2026-09-03 16:04:23 +03:00
parent f9504eb14a
commit 331165e003
2 changed files with 178 additions and 2 deletions
+18 -2
View File
@@ -27,8 +27,11 @@ Each local snapshot is named `move-YYYYMMDD-HHMMSS`.
- Run the script as an account that can use `zfs` on the source server.
- The source host needs Bash, ZFS utilities, and SSH.
- The destination host needs ZFS utilities and the destination pool must exist.
- Both hosts need `rsync` to run the verification script.
- The SSH account on the destination must be able to execute `sudo -n zfs`
without a password prompt.
- For verification, that account must also be allowed to run `sudo -n rsync`
without a password prompt.
- SSH must use a private key or SSH agent. Password authentication is disabled
by the script so a migration cannot pause and prompt once per dataset.
- SSH connectivity and host-key verification must already work.
@@ -48,6 +51,16 @@ Example:
bash zfs-move-over-ssh.sh tank root@new-server backup/tank
```
Verify the resulting filesystems after mounting them on both hosts:
```bash
bash zfs-verify-over-ssh.sh tank root@new-server backup/tank
```
The verifier maps datasets using the same relative paths as the move script.
It uses a read-only `rsync --dry-run --checksum` comparison and exits with
status `1` when it finds missing, extra, changed, or metadata-different files.
Use a non-standard SSH key or port when needed:
```bash
@@ -139,10 +152,13 @@ Options:
bash zfs-move-over-ssh.sh tank admin@new-server backup/tank
```
5. Verify the received datasets and data before retiring the source:
5. Mount the received datasets, then verify their data before retiring the
source. `zfs-move-over-ssh.sh` receives with `-u`, so the destination filesystems
are unmounted until you explicitly mount them:
```bash
ssh admin@new-server 'sudo zfs list -r backup/tank'
ssh admin@new-server 'sudo zfs mount -a'
bash zfs-verify-over-ssh.sh tank admin@new-server backup/tank
```
## Safety and Recovery