# Badblocks recovery

## henniez-swisswater

Hallo,

I've got a problem with my harddrive. I discovered several bad blocks on my drive, so I tried many things and read many forum posts, but i didn't find anything about how to prevent the drive from accessing the bad blocks.

I tried to format the drive on a windows system as ntfs, astonishingly it work and I could use the drive again. The only thing was, that I lost about 70 MB due to  the bad blocks I guess. 

I am wondering if there is also a possibility to fix the bad blocks problem in a similar way. I think it must be possible to tell the filesystem (I'm using ext2/3) to avoid the bad blocks. Unfortunately, I couldn't find any help in a forum and couldn't  figure it out myself either.

If any of you have an idea what could be done, i would be most grateful.

regards

----------

## gouranga

Marking bad blocks is an action that the firmware of the hard disk does for you.

Who is the manufacturer of you hard disk?

Fe Maxtor/Seagate offers several tools to check your hard disk.

You only have a problem when you have a Toshiba hard disk. (No tools available)

If you want to recover a volume with bad blocks, you can create an image with "dd" of the volume.

"dd" copies everything, even the bad blocks. 

If you have a journaling FS, you just have to run the repair tool to replay your journal and check for inconsistencies.

Storing data on a disk with bad blocks is not a smart id.

Bad blocks are most of the time the precursor of total hard disk corruption.

If for some reason the firmware of the hard disk doesn't mark the bad blocks, 

you could create partitions that are not containing the bad blocks.

Use the tools from the manufacturer to determine the bad block location and start calculating how many MB there are before the bad block.

If you are lucky there are enough MB's available to create a decent partition.

It's also wise to monitor the disk with smartools. Check the howto on gentoo-wiki.com.

----------

## lagalopex

```
fsck.ext3 -c -k -f ...
```

will check for bad blocks and prevent the fs to use them...

but, when bad blocks occure, the harddisk will become worse and fail after a while...

there is only some space for the harddrives firmware to remap bad sectors...

----------

## NeddySeagoon

henniez-swisswater,

The drive will attempt to hide bad blocks from the operating system until it has run of of "spare blocks".

At this time the drive is end of life. The bad blocks continue to spread and you lose any data that was in them.

The only thing to do is to replace the drive. 

When you installed Windows, it read the entire drive and marked as 'bad' blocks it could not read. Thats what its format spends most of its time doing.

The -c or -cc options to mke2fs do different levels of checking of the drive in the course of filesystem creation. Read the man page. You will get a filesystem that has no errors at the time of creation but its unlikely to stay that way.

----------

## henniez-swisswater

Thx for your answers, im gonna try to create a partition without the bad blocks. mke2fs -c didn't work, there were some input output errors (i guess this means the day of this drive are over soon)

Anyway i want to see how long it takes until the drive crashes completely.

 :Razz: 

thx again for you answers

----------

