manpagez: man pages & more
info ddrescue
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8. Fill Mode

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

In fill mode the input file may have any size. If it is too small, the data will be duplicated as many times as necessary to fill the input buffer. If it is too big, only the needed data will be read.

Note that in fill mode the input file is always read from position 0. If you specify a ‘--input-position’, it refers to the original input file from which the logfile was built, and is only used to calculate the offset between input and output positions.

Note also that when filling the input file of the original rescue run you should set ‘--input-position’ and ‘--output-position’ to identical values, whereas when filling the output file of the original rescue run you should keep the original offset between ‘--input-position’ and ‘--output-position’.

The ‘--fill’ option implies the ‘--complete-only’ option.

In fill mode the logfile is updated to allow resumability when interrupted or in case of a crash, but as nothing is being rescued the logfile is not destroyed. The status line is the only part of the logfile that is modified.


The fill mode has a number of uses. See the following examples:

Example 1: Mark parts of the rescued copy to allow finding them when examined in an hex editor. For example, the following command line fills all blocks marked as ‘-’ (bad-sector) with copies of the string ‘BAD SECTOR ’:

 
echo -n "BAD SECTOR " > tmpfile
ddrescue --fill=- tmpfile outfile logfile

Example 2: Wipe only the good sectors, leaving the bad sectors alone. This way, the drive will still test bad (i.e., with unreadable sectors). This is the fastest way of wiping a failing drive, and is specially useful when sending the drive back to the manufacturer for warranty replacement.

 
ddrescue --fill=+ --force /dev/zero bad_drive logfile

Example 3: Force the drive to remap the bad sectors, making it usable again. If the drive has only a few bad sectors, and they are not caused by drive age, you can probably just rewrite those sectors, and the drive will reallocate them automatically to new "spare" sectors that it keeps for just this purpose. WARNING! This may not work on your drive.

 
ddrescue --fill=- --force --synchronous /dev/zero bad_drive logfile

Fill mode can also help you to figure out, independently of the file system used, what files are partially or entirely in the bad areas of the disc. Just follow these steps:

1) Copy the damaged drive with ddrescue until finished. Do not use sparse writes. This yields a logfile with only finished (‘+’) and bad-sector (‘-’) blocks.

2) Mount the copied drive (or the image file, via loopback device).

3) Compute a md5sum or other checksum for every file. Build a list of all the files and their checksums.

4) Fill the bad-sector blocks of the copied drive or image file with a byte value different from zero.

5) Verify the checksums. Those files which have different checksums this time reside (at least partially) in damaged disc areas.

6) Optionally fill the bad-sector blocks of the copied drive or image file with zeros to restore the disc image.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2017
Individual documents may contain additional copyright information.