How to detect hard disk failure ?

Pranav A. Desai pdesai1 at cs.uh.edu
Fri May 16 07:27:58 PDT 2003


Hi!

   We deal with proxy caches and in my experience when there is a disk
failure the system becomes dead in a few seconds because of the heavy disk
usage. So we probably wont be able to do an entire disk scan (36G or
more).

I looked at some libdisk functions (Open_Disk() etc.) and they do seem to
open and write to disks, which will indicate whether a disk is usable or
not. We need to do it as a periodic task, so I am not sure if this will
affect the performance or whether it will even work.

The other thing that I thought of doing is to capture /var/log/messages
for any errors regarding disks. But I have two problems with that.
1) I dont know how to do tail -f in shell script.
2) I am not sure if messages gives all kinds of disk errors.

any thoughts...

thanks
-pranav

*******************************************************************
Pranav A. Desai


On Fri, 16 May 2003, Andy Farkas wrote:

> On 15 May 2003, Lowell Gilbert wrote:
>
> > >    Is there a way to detect hard disk failures using either a shell script
> > > or C program ? So that I can take appropriate action in case of a hard
> > > disk failure.
> >
> > You can keep watch the logs for errors accessing the disks...
>
> You can do a "dd if=/dev/ad0 of=/dev/null bs=64k" to read the entire disk
> surface - if there are bad blocks, read errors will show up on the
> console.
>
> --
>
>  :{ andyf at speednet.com.au
>
>         Andy Farkas
>     System Administrator
>    Speednet Communications
>  http://www.speednet.com.au/
>
>
>



More information about the freebsd-questions mailing list