I have a hard drive partition (/dev/sdb1, ubuntu 16.04 partition)with bad sectors I intend to create an image of the partition with bad sectors and then restore to a new drive/partition.

First I run ddrescue without trying to read the bad sectors using

sudo ddrescue -n /dev/sdb1 sdb1_n.img sdb1_n_log.txt

The I run ddrescue with the -r option so that repeated attempts to read bad sectors along with the good sectors:

sudo ddrescue -d -r3 /dev/sdb1 sdb1_d_r3.img sdb1_d_r3_log.txt

Strangely the second run with -r3 gives more error locations on the log file than on the first run. The size of the images are however same.

Which image should I use for restoring the one created using -n option or the one created with -d -r3 option?


My experience is that additional sectors are read (and their content recovered) when you run the second time with the option -r3. So use the image after running with the option -r3.

According to the tutorial chapter '9. A small tutorial with examples' in

info ddrescue

I also use -r3 (3 retries).

The number of areas marked as bad may increase, but the total amount of bad sectors will decrease, when new sectors are read during the -r3 run.

In the chapter '4. Algorithm' we find a detailed explanation,

The total error size is the sum of the sizes of all the bad-sector blocks. It increases during the trimming and scraping phases, and may decrease during the retrying phase. A sector is not marked as bad-sector and considered part of a bad area until it has been tried individually instead of as part of a large block read. Non-trimmed and non-scraped blocks are not considered bad areas. Note that as ddrescue retries the bad-sector blocks, the good data found may divide them into smaller blocks, decreasing the total error size but increasing the number of bad areas.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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