Last active
August 29, 2019 16:23
-
-
Save zentrification/a39a1d1c758918674f45b1989c91c961 to your computer and use it in GitHub Desktop.
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 | |
# https://www.backblaze.com/blog/what-smart-stats-indicate-hard-drive-failures/ | |
ATTRIBUTES=" 5|187|188|197|198" | |
for DRIVE in `ls /dev/sd[a-z]`; do | |
COUNT=$(sudo smartctl -A $DRIVE | grep -E "$ATTRIBUTES" | grep -v " 0$" | wc -l) | |
echo "" | |
echo $DRIVE | |
echo "$COUNT attributes failing" | |
if (($COUNT > 0)); then | |
sudo smartctl -A $DRIVE | grep -E "$ATTRIBUTES" | grep -v " 0$" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment