Task
A ZFS pool (opsdata) was exported from a set of loopback block devices now stored as image files. Among these images: some carried valid ZFS labels for the pool, some carried stale labels from a replaced mirror member, and at least one was a red herring that never participated in the pool. The pool used ZFS native encryption with one valid keyfile among several candidates.
Goal: import the correct device set, decrypt the pool, identify the right historical snapshot (containing report_2024.pdf but not report_2024_final.pdf), and produce:
/app/zpool_status.txt— fullzpool statusoutput post-scrub, all devicesONLINE, zero errors/app/output.json— pool device count, scrub checksum errors, degraded device count, active keyfile name, SHA-256 hashes of all files in the recovered snapshot
Approach
- Inspected ZFS labels across all device images using
zdbto distinguish valid members from stale/red-herring devices - Tested each candidate keyfile with
zfs load-keyto find the one that successfully decrypted the datasets - Enumerated snapshots and inspected dataset root directory contents to identify the correct rollback target
- Imported the pool, ran a full scrub, verified zero errors and all devices
ONLINE
The zfs promote restructuring added complexity — the dataset hierarchy had been reorganised after snapshots were taken, requiring careful traversal to match snapshots to their dataset roots.
Key Techniques
ZFS label inspection (zdb), mirror vdev recovery, native ZFS encryption (zfs load-key), snapshot dataset traversal, zfs promote hierarchy reasoning, SHA-256 file hashing
Environment
Isolated Docker container. Automated output validation checked JSON schema values and zpool status contents. Iterated until all rubric checks passed.