Created
August 13, 2017 15:17
-
-
Save crazy-max/b95b936b4d3888af8e0b5a46eab46697 to your computer and use it in GitHub Desktop.
Checking disks for important SMART errors
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 | |
TMP_FILE=/tmp/check-smart-errors.log | |
for I in $(ls /sys/block); do | |
smartctl -a /dev/$I > $TMP_FILE | |
if [ "$?" -ne "1" ]; then | |
DEVICE_MODEL="$(smartctl -a /dev/$I | grep -i 'device model')" | |
echo "DISK $I - $DEVICE_MODEL" | |
cat "$TMP_FILE" | grep -v "\- 0" | grep Raw_Read_Error_Rate | |
cat "$TMP_FILE" | grep -v "\- 0" | grep Reallocated_Event_Count | |
cat "$TMP_FILE" | grep -v "\- 0" | grep Reallocated_Sector_Count | |
cat "$TMP_FILE" | grep -v "\- 0" | grep Reported_Uncorrectable_Errors | |
cat "$TMP_FILE" | grep -v "\- 0" | grep Command_Timeout | |
cat "$TMP_FILE" | grep -v "\- 0" | grep Current_Pending_Sector_Count | |
cat "$TMP_FILE" | grep -v "\- 0" | grep Offline_Uncorrectable | |
cat "$TMP_FILE" | grep -v "\- 0" | grep CRC_Error_Count | |
cat "$TMP_FILE" | grep -v "\- 0" | grep Seek_Error_Rate | |
cat "$TMP_FILE" | grep "^ATA Error Count" | |
cat "$TMP_FILE" | grep "^Error [0-9]* occurred at disk" | |
echo "----------------" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment