1

I backed up a failing harddrive with ddrescue. The command I used was

# ddrescue -vv -d -J /dev/sda /mnt/rescue/winxp.img winxp.map

The program completed with around 60 errors. I wanted to retry only the failed blocks. I found this section in the manpage:

-m file
--domain-mapfile=file
    Restrict the rescue domain to the blocks marked as finished in the
    mapfile file. This is useful for merging partially recovered images of 
    backups, or if the destination drive fails during the rescue. Use '-' 
    as file to read the domain mapfile from standard input. Specialized 
    tools like ddrutility or partclone can produce a domain mapfile 
    listing all the used blocks in a partition, making the rescue more
    efficient.
-M
--retrim
    Mark all failed blocks inside the rescue domain as non-trimmed before
    beginning the rescue. The effect is similar to '--retry-passes=1', but
    the bad sectors are tried in a different order, making perhaps
    possible to rescue some of them.

The next command I issued was

# ddrescue -vv -d -M -m winxp.map /dev/sda /mnt/rescue/winxp.img winxp.2.map

I thought this would only retry the previously failed blocks. However, it seemed to start at the whole process again and trying to rescue the entire disk.

Is there a way to only retry the failed blocks and, on success, save them in the previous image?

2

You need to use the same map file each time - this is where it records the regions which have been tried and whether they succeeded or failed.

You typically do not need to change the command from run-to-run, simply re-issuing it will cause it to re-try the failed regions (again).


Using -m will (as the manual states) "Restrict the rescue domain to the blocks marked as finished in the mapfile file." - i.e: only try reading the successful blocks.

Again, as the manual states, this is useful in conjunction with other utilities to reduce the amount of data read, and potentially reduce the runtime and number of errors encountered.

  • 1
    It worked. I was recently testing another drive with badblocks, which only records failed blocks. I guess, I was stuck in that line of thinking and understood finished as failing blocks that all rescue measures (tried, trimmed and scraped) have been applied to. Anyway, it took some hours to finish but it recovered 100% of the disk. Thanks. – nautical Apr 29 '18 at 9:42

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.