cat bin/smartchk.sh cd `dirname $0` if [ $# -ne 1 ]; then echo $0" need disk device" exit 1 fi smartctl -A $1 | awk '$2=="Raw_Read_Error_Rate"||$2=="Reallocated_Sector_Ct"||$2=="Reallocated_Event_Count"||$2=="Current_Pending_Sector"||$2=="Offline_Uncorrectable"' | awk '$4>$6 {print $2 " " $4 " " $5 " " $6}' > smartctl.tmp if [ -s smartctl.tmp ]; then echo $1" NG!" cat smartctl.tmp exit 1 else echo $1"Normal" exit 0 fi
参考
http://bitwalker.dtiblog.com/blog-entry-67.html
参照したいくつかのドキュメントで特に重要とされていたのは次の属性。
1 Raw_Read_Error_Rate データ読み込み時に発生したエラーの割合
5 Reallocated_Sector_Ct データを予備エリアに移動した不良セクタ数
196 Reallocation Event Count セクタの代替処理が発生した回数
197 Current_Pending_Sector 現在異常があって代替処理を待つセクタ数
198 Offline_Uncorrectable オフラインテストで発見された回復不可能なセクタ数