Next: , Previous:   [Index]


12 Copying parts of the input file on demand

The command mode of ddrescue implements a scripting interface similar to the one of ed. In this mode commands are read from the standard input and executed to copy parts of the input file to the output file, retrieve information from the mapfile, or write the mapfile to disc. Ddrescue’s responses are written to standard output. "done\n" for a successfully executed command, "error\n" for a failed command (for example because of wrong arguments), and "error: error message\n" for serious or fatal errors like write errors.

If end-of-file is detected on standard input, ddrescue discards any partial command being read and executes the ‘f’ (finish) command.

All ddrescue commands are single characters, though some require additonal parameters separated by spaces. Only one command is allowed per line. Ddrescue recognizes the following commands:

c pos size

Copy command. Copies a block of data from infile to outfile and updates the internal copy of the mapfile. The areas already marked as finished in the mapfile are not copied again.

f

Finish command. Compacts the internal copy of the mapfile and writes it to mapfile (if it was specified in the command line). Then prints "done\n" to standard output and quits. On startup, the mapfile is first compacted and then split following the rescue domain borders. The finish command compacts the mapfile again before exiting. If writing mapfile to disc fails, a non-interactive emergency save is tried before exiting. See Saving the mapfile in case of trouble.

q

Quit command. Exits ddrescue. Does not update the mapfile.

s pos size

Status command. Writes to standard output one or more lines in mapfile format (see Mapfile structure), showing the status of the areas included in the block requested. A line consisting of the string "done" marks the end of the list.

u

Update mapfile command. Writes the internal copy of the mapfile to mapfile (if it was specified in the command line). If update mapfile fails, you may try to fix the problem, for example deleting some files to make room for mapfile, before trying to update it again.


Next: Fill mode, Previous: Direct disc access   [Index]