Add zfs-verify documentation to readme.md

This commit is contained in:
2026-09-03 16:07:27 +03:00
parent 331165e003
commit c968c0656e
+54
View File
@@ -70,6 +70,60 @@ bash zfs-move-over-ssh.sh \
tank admin@new-server backup/tank tank admin@new-server backup/tank
``` ```
## Verification
`zfs-verify-over-ssh.sh` compares each ZFS filesystem below `SOURCE_POOL` to
the corresponding filesystem below `DESTINATION_ROOT`. For example,
`tank/data/documents` is compared with `backup/tank/data/documents`.
```bash
bash zfs-verify-over-ssh.sh [options] SOURCE_POOL REMOTE_HOST DESTINATION_ROOT
```
Both sides of every filesystem pair must be mounted. The transfer script uses
`zfs receive -u`, so mount the received remote datasets before verification:
```bash
ssh admin@new-server 'sudo zfs mount -a'
bash zfs-verify-over-ssh.sh tank admin@new-server backup/tank
```
The verifier uses `rsync` with `--dry-run`, `--checksum`, `--delete`, archive
metadata preservation, hard-link checking, ACL checking, extended-attribute
checking, and `--one-file-system`. It does not modify either host. Any
itemized `rsync` output identifies an extra, missing, changed, or
metadata-different path.
Verification options:
| Option | Description |
| --- | --- |
| `-i`, `--identity-file FILE` | Use the specified SSH private key. |
| `-p`, `--ssh-port PORT` | Connect to the specified SSH port. |
| `-h`, `--help` | Show command help. |
Use the same key and port options as the transfer when required:
```bash
bash zfs-verify-over-ssh.sh \
--identity-file ~/.ssh/zfs-migration \
--ssh-port 2222 \
tank admin@new-server backup/tank
```
Exit statuses:
| Status | Meaning |
| --- | --- |
| `0` | All checked filesystems are identical. |
| `1` | One or more filesystem pairs have differences. |
| `2` | Verification could not run, for example because of missing commands, SSH or sudo access, unavailable datasets, or unmounted filesystems. |
For a stable result, stop writes to the source and destination while the
verifier runs, or verify mounted clones of the same snapshots. The verifier
checks file content and selected filesystem metadata; it does not compare ZFS
dataset properties, snapshots, quotas, reservations, or encryption settings.
## SSH Setup ## SSH Setup
Create a dedicated key on the source server if one does not already exist: Create a dedicated key on the source server if one does not already exist: