Add ability to test pool recovery

This commit is contained in:
2026-09-04 16:22:58 +03:00
parent 307aa55356
commit 2d6c410489
2 changed files with 129 additions and 1 deletions
+39 -1
View File
@@ -95,4 +95,42 @@ sudo zdb -l /dev/sdX
```
`wipefs --no-act` reports signatures without modifying the device. `zdb -l`
should not find a readable ZFS label after a successful run.
should not find a readable ZFS label after a successful run.
## Recovery Assessment
`verify-zpool-recovery.sh` checks whether ZFS can find and rewind an exported
or faulted pool. It cannot restore labels that have been completely overwritten
by the eraser, so recovery after a successful erase is unlikely. Use it before
erasing a device, or when ZFS still detects at least part of the pool metadata.
List pools ZFS can discover without modifying anything:
```bash
sudo ./verify-zpool-recovery.sh
```
Check whether a specific pool can be recovered with a transaction rewind. This
uses `zpool import -nF`, which is a dry run:
```bash
sudo ./verify-zpool-recovery.sh tank
```
If vdevs must be found in a non-default directory, supply it explicitly:
```bash
sudo ./verify-zpool-recovery.sh --directory /dev/disk/by-id tank
```
After reviewing the dry-run output, attempt the import with rewind recovery:
```bash
sudo ./verify-zpool-recovery.sh --apply tank
```
`--apply` runs `zpool import -N -F`: `-F` may discard the most recent
transaction groups, and `-N` imports the pool without mounting datasets. The
script requires the exact confirmation `RECOVER tank` before issuing that
command. Inspect the result with `zpool status tank` before mounting datasets
or performing any further changes.