I like being able to check the health of all ZFS pools on all systems with one command.
It's easy enough to find the status just by running zpool status
,
but I want something more compact. Just show me each host with either
a single line showing me all's well, or show me the errors.
My main system is called furbag, and my backup box is called hairball. I run a health-check like so:
me% zpool-check ZFS POOL HEALTH --------------- furbag: all pools are healthy hairball: pool: newroot state: ONLINE status: One or more devices has experienced an unrecoverable error. An attempt was made to correct the error. Applications are unaffected. scan: scrub repaired 256K in 01:24:58 with 0 errors on Fri Feb 28 05:17:20 2025 config: NAME STATE READ WRITE CKSUM newroot ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 ada0p4 ONLINE 0 0 0 ada1p4 ONLINE 0 0 0 da0p4 ONLINE 0 0 2 errors: No known data errors pool: tank state: ONLINE status: One or more devices has experienced an unrecoverable error. An attempt was made to correct the error. Applications are unaffected. scan: scrub repaired 4.82M in 06:08:40 with 0 errors on Sat Mar 1 09:16:46 2025 config: NAME STATE READ WRITE CKSUM tank ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 ada2 ONLINE 0 0 4 ada3 ONLINE 0 0 2 errors: No known data errors
root# zpool clear newroot da0p4 root# zpool clear tank ada3 root# zpool clear tank ada2
me% zpool-check ZFS POOL HEALTH --------------- furbag: all pools are healthy hairball: all pools are healthy
The zpool-check script can be found here. I have the hostnames hardcoded in an associative array; for larger setups, a separate config file would be a better idea.
Feel free to send comments.
Generated from article.t2t by
txt2tags
$Revision: 1.2 $
$UUID: 78dcf9d1-b52e-3842-9bba-2f3a7fd7ab95 $