I'm using Example 3 from gddrescue's documentation here to zero-write a disk and force pending bad sectors on it to be reallocated.

The same documentation states elsewhere that:

If mapfile does not exist, ddrescue will create it.

But when I run Example 3 near-verbatim:

ddrescue -vvvv --fill-mode=- -f --synchronous /dev/zero /dev/sdc mapfile.txt

...I get the error:

ddrescue: Mapfile 'mapfile.txt' does not exist or is not readable.

If I run:

ddrescue -vvvv --fill-mode=- -f --synchronous /dev/zero /dev/sdc -m /cygdrive/b/users/user/desktop/mapfile.txt

...I get a truncated version of the same error:

ddrescue: Mapfile '/cygdrive/b/users/user/desktop/mapfile.txt' does not exist or is not

I'm using gddrescue on Windows 7, via Cygwin.

Is this a bug with the Cygwin implementation of dd, or am I missing something?


Not a bug. It's the same on my Kubuntu. I think it's because of --fill-mode option you used. This mode has its own chapter of the documentation. What you are missing is this part [emphasis mine]:

When ddrescue is invoked with the --fill-mode option it operates in "fill mode", which is different from the default "rescue mode". That is, if you use the --fill-mode option, ddrescue does not rescue anything. It only fills with data read from infile the blocks of outfile whose status character from mapfile coincides with one of the type characters specified as argument to the --fill-mode option.

This means --fill-mode needs an already existing mapfile.

What are status characters and type characters here?

The phrase "status character from mapfile" should be understood according to this fragment:

The status character is one of these:

Character Meaning
'?' non-tried block
'*' failed block non-trimmed
'/' failed block non-scraped
'-' failed block bad-sector(s)
'+' finished block

And here is an example mapfile:

# Mapfile. Created by GNU ddrescue version 1.23
# Command line: ddrescue -d -c18 /dev/fd0 fdimage mapfile
# Start time:   2015-07-21 09:37:44
# Current time: 2015-07-21 09:38:19
# Copying non-tried blocks... Pass 1 (forwards)
# current_pos  current_status  current_pass
0x00120000     ?               1
#      pos        size  status
0x00000000  0x00117000  +
0x00117000  0x00000200  -
0x00117200  0x00001000  /
0x00118200  0x00007E00  *
0x00120000  0x00048000  ?

Now "type characters specified as argument to the --fill-mode option" are characters that appear just after --fill-mode=.

So if the mapfile is like the above example and you use

  • --fill-mode=-, then ddrescue will only fill 0x00000200 blocks starting at the position 0x00117000;
  • --fill-mode=?-* (beware of shell globbing, unlikely but still), then ddrescue will fill fragments marked with ?, - or *.
  • My bad, I hadn't actually seen this answer, didn't get a notif for it for some reason. Your answer does answer the question, and looks it will be the accepted answer, but it would be really useful if you could explain to me what the last sentence actually means - I read it a few times before posting this question, but couldn't understand what it was saying for the life of me. Specifically, the "...whose status character from mapfile coincides with one of the type characters specified as argument" part. In plain English, what exactly are status characters and type characters here? – Hashim Apr 30 '18 at 23:00

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.