Message Board -  Archive

[ Login ] [ Create Account ]
[ Board List ] [ View Board ] [ Post Reply ]
  Author  Subject: Re: Bad Block HDD in linux

Posted on 04-01-2004 03:13 p.m. ET  reply

Original Poster: Mark Krentel

> how to move the data from bad sector HDD in linux reiserfs system
> and how to skip to write bad sectors in linux reiserfs

The way to salvage data from a disk with failing blocks is to copy the
partition with dd and use the "conv=noerror,sync" options. This will
read the partition as best it can and replace any unreadable sectors
with zeros (nulls). For example:

dd if=/dev/oldpartition of=/path/to/file conv=noerror,sync

Then, on a good disk, make a partition with the exact same number of
sectors and preferably the same geometry: cyls-heads-sectors/track.
Use dd to copy the image into the new partition and run fsck on it.

dd if=/path/to/file of=/dev/newpartition
fsck -f /dev/newpartition

That will repair the file system as best it can. After the partition
passes fsck, then you can mount it and copy whatever files are left.
Run fsck a couple of times until it finishes a pass with no new

I don't use Reiserfs, so the fsck command (file system check) for
Reiserfs may be named something else. If the disk has many bad
sectors, the first dd command may take a long time to go through all
the retries and timeouts. Also, after the fsck, you may find some of
your files or parts of files in the lost+found directory.

There is a command badblocks that will scan a disk and produce a list
of bad sectors that mke2fs can use to skip those sectors. Also, most
formatting commands (eg. mke2fs) have an option to run badblocks
first. (Don't run badblocks on a partition with data on it.) But if
the disk has failing sectors, then you really should just replace the


< Previous 1 Next >

Site Contents