Pages

Tuesday, March 25, 2014

HDD health check script

******************************************************
for i in `lshw -class disk -class tape | grep "logical name" | cut -d: -f2`; do echo Disk $i ; echo "=========================================" ;smartctl --all $i | grep 'PASSED\|Reallocated_Sector_Ct\|Temperature_Celsius' ; echo " "; done
*****************************************************
Sample Output:
[root@localhost ~]# sh test.sh 
Disk /dev/sda 
=========================================
SMART overall-health self-assessment test result: PASSED
5 Reallocated_Sector_Ct 0x0033 100 100 036 Pre-fail Always - 0
194 Temperature_Celsius 0x0022 028 048 000 Old_age Always - 28 (0 19 0 0 0)

Disk /dev/sdb
=========================================
SMART overall-health self-assessment test result: PASSED
5 Reallocated_Sector_Ct 0x0033 100 100 036 Pre-fail Always - 0
194 Temperature_Celsius 0x0022 024 048 000 Old_age Always - 24 (0 15 0 0 0)

[root@localhost ~]#

0 comments:

Post a Comment