Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The laptop in question has a hard drive that is beginning to have corrupt sectors. It's to the point where Windows won't boot b/c a system file has fallen victim.

I'm sure that the drive needs to be replaced, no point messing with something flaky, but it's a 320GB disk with probably 160GB+ of stuff on it.

What's the best way to save the files that can be saved?

I'm thinking boot a linux live USB stick and work from that, but not sure what 'dd' will do when it hits bad sectors. I want something that will just skip bad sectors, and preferably eliminate the files that contain them. (not sure 'dd' would do that, either)

I'm asking here b/c I don't want to experiment; not sure how many more passes this thing will take before it goes stone cold dead. What's the best way to grab the most complete image of the files that can be read? The ideal method will get the files that can be gotten without re-tries, and then optionally after treating the whole disk, go back and maybe do re-tries to get the files with dubious sectors in them.

share|improve this question
up vote 4 down vote accepted

The tool you are looking for is GNU ddrescue. It's like dd, but each subsequent time you run it on the same output file, it will try to fill in any missing data.

Here are the homepage and documentation.

It should be available on most common systems (in the repo, if not on the disk).

I don't know of any such program that operates at the filesystem level.

share|improve this answer
interesting - so the output file somehow stores some metadata that says which parts represent bad sectors? Suppose some sectors are just irrevocably lost; does that mean when I mount the image, if I read a file that includes such a sector, the mounted image will 'have the error'? I.e., if there's a corrupt file in the image, will I know it? Hoping the answer to that is 'yes'.. – JustJeff Aug 17 '12 at 2:13
The metadata is stored in a log file that you specify. Unfortunately, since dd is a low-level tool, it is not aware of the specific filesystem. You can probably find information about specific bad blocks in the log file, and there are ways to determine which file contains that sector:… – user55325 Aug 20 '12 at 18:49

Use a drive image software, image the hard drive, then mount the image and work with that, most image software can be configured to skip unreadable/bad sectors, making the image process as short as possible and continue to the end uninterrupted. This will be the least stress on the hard drive, which may not have much time left before total failure.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .