Gddrescue asks for a mapfile but refuses to create one

1

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?

Hashim

Posted 2018-04-12T22:16:43.037

Reputation: 6 967

Answers

2

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 *.

Kamil Maciorowski

Posted 2018-04-12T22:16:43.037

Reputation: 38 429

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 – 2018-04-30T23:00:23.750