Last active
November 20, 2018 09:53
-
-
Save dasjoe/a7252e3f737ec36de36f to your computer and use it in GitHub Desktop.
Check SMART values for ata-* disks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DIR='/dev/disk/by-id/' | |
#DIR='/dev/disk/by-vdev/' | |
#DIR='/dev/disk/by-path/' | |
PREFIX='ata-*' | |
#PREFIX='pci-*' | |
#PREFIX='*' | |
while IFS= read -r -d '' disk | |
do | |
smartctl -a "$disk" \ | |
| egrep "self-assessment test result|^ 5 |^187 |^19(6|7|8) " \ | |
| egrep -v 'PASSED$| 0$' \ | |
&& echo -e "$disk\n" \ | |
|| true | |
done < <(find "$DIR" -xtype b -name "$PREFIX" -not -name '*-part*' -print0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment