[CentOS] Detecting harddrive problem

Fri Feb 25 17:15:36 UTC 2011
compdoc <compdoc at hotrodpc.com>

> Recently I realize the filesystem became Read-only and there is "media
> error" message in the system log. It has passed several days without
> notice.
> I'm thinking of setting up a script to grep that "media error" and send
email.
> Is there more elegant way of doing this?


This doesn't really answer your question, but if you issue the command
"smartctl -a /dev/sdx" and see either a Reallocated sectors count, or a
Current Pending sector count that's greater than 0, then you need to keep an
eye on the drive. It could be failing. (replace /dev/sdx in the command with
your drive's actual device)

Reallocated sectors count is for failed write attempts, and that number
tends to grow after the count gets larger than 0.

Current pending sector count is for failed read attempts, which could be a
fluke and might correct itself later. It's not as serious as Reallocated
sectors.