I received another warning on a drive today about not being able to read the SMART info. So as I normally do I check run smartctl against it.
This turned up some reallocation entries. Hmm how do I easily check all drives at once for a specific SMART entry?
Bit of simple for and awk and I can!
for i in `camcontrol devlist | awk '{print $10}' | awk -F\, '{print $1}' | awk -F\( '{print $2}'`; do smartctl -a /dev/$i | grep "Reallocated"; done
That’s a keeper! 🙂
A slight change I think gives a bit more info and the device name:
for i in `camcontrol devlist | awk '{print $10}' | awk -F\, '{print $1}' | Â awk -F\( '{print $2}'`; do echo $i; smartctl -a /dev/$i | egrep "Error|Pending|Reallocated"; done