## 8 Mapfile structure ¶

NOTE: In versions of ddrescue prior to 1.20 the mapfile was called ‘`logfile`’. The format is the same; only the name has changed.

The mapfile is a text file easy to read and edit. It is formed by three parts, the heading comments, the status line, and the list of data blocks. The character ‘`#`’ at begin of line or after whitespace starts a comment that extends to the end of the line.

The heading comments contain the version of ddrescue or ddrescuelog that created the mapfile, the command line used, and the time when the program started. If the mapfile was created by ddrescue it also contains the current time when the mapfile was saved and a copy of the status message from the screen describing the operation being performed (copying, trimming, finished, etc). They are intended as information for the user.

The first non-comment line is the status line. It contains a non-negative integer, a status character, and a positive decimal integer. The first integer is the position being tried in the input file. (The beginning of the block being tried in a forward pass or the end of the block in a backward pass). The status character is one of these:

Character | Meaning
--- | ---
’?’ | copying non-tried blocks
’*’ | trimming non-trimmed blocks
’%’ | sweeping non-tried blocks
’/’ | scraping non-scraped blocks
’-’ | retrying bad sectors
’F’ | filling the blocks specified
’G’ | generating approximate mapfile
’+’ | finished

Finally, the last integer is the number of the current pass in the current phase. The status line allows ddrescue to resume the copying phase instead of restarting it from pass 1. It also allows the retrying phase to resume in the same direction it was interrupted.

The blocks in the list of data blocks must be contiguous and non-overlapping.

Every line in the list of data blocks describes a block of data. It contains 2 non-negative integers and a status character. The first integer is the starting position of the block in the input file, the second integer is the size (in bytes) of the block. 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.30
    # 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  ?

If you edit the file, you may use decimal, hexadecimal, or octal values, using the same syntax as integer constants in C++, except for current_pass, which must be a decimal integer.