# how do I check hard drive?

## veggie2u

My gentoo computer crashed - became unresponsive under KDE, and I pushed the reset button. It ran checks for a long time ( main root partition is ext3 ) and finally got to a login prompt. Many commands now give kernel errors. I am trying to figure out how to recover, but the real question is how can I check the hard drive to make sure that it is not failing? Especially if I am planning to reinstall.

----------

## darktux

 *Quote:*   

> 
> 
> fsck - check and repair a Linux file system
> 
> DESCRIPTION
> ...

 

man fsck

----------

## veggie2u

I thought that fsck was used to repair filesystems, not check drive integrity. I have run fsck on the drive, but the same problems persist. If I run fsck again, it finds more errors that it tries to fix. But afterward, when I try to do a normal boot, it will just hang somewhere.

----------

## darktux

What flags do you pass to fsck?

----------

## Malakin

Go to the manufacturers website for the hard drive you have and they will have a utility for testing the drive, they detect a problem about 75% of the time that a problem actually exists in my experience, so even if they claim there is none there still could be. Clicking/clunking noises and slow performance are also possible indicators of a failing drive.

----------

## veggie2u

I don't think I passed any flags other than specifing the partition.

I can try the manufactures web site, but that will likely be a non-linux utility, right?

----------

## veggie2u

Not sure why I didn't think of a tool from the manufactuer.   :Embarassed:  I guess I was thinking in the 'linux world' only. It turns out that WD does appear to have such a tool that can be run from a dos boot disk, so I will try that tonight.

Thanks

----------

## veggie2u

Well, status comes back OK on the drive. Still won't boot though.

----------

## darktux

Try e2fsck -c /dev/something

 *e2fsck's man page wrote:*   

> 
> 
> -c     This option causes e2fsck to run  the  badblocks(  program  to
> 
>               find  any blocks which are bad on the filesystem, and then marks
> ...

 

----------

## veggie2u

I will try with the -c option. I can't tell if it is the /boot or / partitions when it gives me trouble.

I actually did find an error on the disk after doing a more lengthy test. I am trying to ask WD about it, but not getting too far. How can I tell what sector the error is at? Could I then try to partition the drive such that the sector where the error is, is not used?

----------

## darktux

I believe that all the HD have a list of bad blocks, and that e2fsck running with the -c option, if it's able to fix it, will add those nodes to the "black list" so that they aren't used again.

I believe that's the way things work   :Rolling Eyes: 

----------

## Tuna

anyway.. such discs are well known for going near the end of their lifetime (of course not always.. but its a typical sign) and should not contain sensetive data that may be important, as drive failure _may_ occur.

----------

## Malakin

 *Quote:*   

> I actually did find an error on the disk after doing a more lengthy test.

 If their diagnostic software gives you any error codes I'd RMA the drive, they usually only get worse. Their software won't show error codes just because of bad sectors (unless the number of bad sectors exceeds a certain number).

----------

## veggie2u

I have found more errors than I thought would be possible for a drive that worked one day, and not the next!!! (using e2fsck -c /dev/hda3)

I figured that I wouldn't be able to RMA the drive. It is a little old! But my surprise, I just got an email from WD with directions for an RMA!! 

Luckily there was no data on it, other than a Gentoo install I had been playing with. 

Thanks

veggie2u

----------

