I'm curious what shell scripts you all have written to keep up with your storage. I'm mostly curious about the output, i.e., what insights do you find regularly useful? Here's my favorite. It's actually 5 scripts called by one alias:
Notes on each block and the source data:
sh:
$ storage_report
DEV CAPAC ZPOOL TMP AGE SLFTEST PREFAIL
da0 22T zstore 26C 1.0 5/083/. ......
da1 22T zstore 27C 1.0 4/053/. ......
da2 20T zstore 25C 2.4 4/022/. .....
da3 20T zbackup 29C 2.4 3/114/. .....
da4 20T zbackup 30C 2.5 1/083/. .....
da5 20T zbackup 28C 2.5 0/053/. .....
nda0 8T zfast 30C 0.1 -/---/- ---
nda1 932G zroot 26C 3.8 -/---/- ---
PHYS 2U 4x3 SAS
[ da2:20T] [ da5:20T] [ ] [ ]
[ da1:22T] [ da4:20T] [ ] [ ]
[ da0:22T] [ da3:20T] [ ] [ ]
NAME USED SIZE AVAIL
zroot #◦◦◦◦◦◦◦◦◦◦ 12% 113.0G 899.0G 786.1G
zfast ######=◦◦◦◦ 59% 4.7T 7.9T 3.2T
zbackup #######=◦◦◦ 71% 28.5T 39.9T 11.4T
zstore ######◦◦◦◦◦ 58% 23.4T 39.9T 16.5T
SOURCE SNAPSHOTS BACKUPS OLDEST
zroot ##### 12/12 ######### 26/26 6 weeks
zfast ##### 12/12 #######=◦ 23/26 2 weeks
zstore ##### 22/22 ######=◦◦ 29/38 2 months
NAME STATE RD WR CK SCRUBBED
zbackup ONLINE 0 0 0 5% complete
zfast ONLINE 0 0 0 0 days ago
zroot ONLINE 0 0 0 0 days ago
zstore ONLINE 0 0 0 16 days ago
All pools are healthy
Notes on each block and the source data:
- Mostly pulls SMART data with smartctl. The last three columns are insightful. Age in years is handy so I know when a HDD is getting old enough to think about replacing. Second to last shows when short/long tests rand and if anything concerning was found (period means no). And the last column has a character for each pre-fail attributes. Any near or below thresholds get flagged. (Again, period means no. An "x" would show if so.)
- My server has a 2U, 12-bay chassis. This is a physical depiction of where drives are installed. sesutil is the primary source.
- Fairly standard file system usage info with my own ASCII graphic for quick reference. I have this block aliased to "zu" as an alternative to "du."
- I use zrepl for backups. This pulls info from the config on what backups should be in place and compares it to what actually exists. Snapshots are the count on the mounted, active use pool, and backups are snapshots on an unmounted backup. Reuses the same mini-ASCII graphic script.
- zpool info to indicate health. Here you can see one scrub is in progress with others showing complete.