Ddrescue For Windows 7

Ddrescue recommends lzip for compression of backups because the lzip format is designed for long-term archiving and provides data recovery capabilities which nicely complement those of ddrescue. (Ddrescue fills unreadable sectors with data from other copies, while lziprecover corrects corrupt sectors with data from other copies). Clone a failing Windows hard disk with ddrescue on Ubuntu Rescue Remix Scenario: The hard disk is starting to throw 'bad block' errors. Windows still works/boots, but who knows for how much longer.

Active6 years, 8 months ago

I am currently working with a 700 GB Seagate hard drive that's beginning to fail. I'll call this 'SDB' from now on. I'd like to clone it while I'm still able to.

However, the only hard drive that I have available is a 500 GB WD hard drive. I'll call this 'SDC' from now on.

The partition scheme on SDB is as follows: 9.77 GB is allocated to a recovery partition and the remaining 688.87 GB is allocated to a Windows partition. Both are formatted using NTFS.

There is no partition scheme on SDC.

I know how to clone one hard drive to another using DDRescue but I've only done it using hard drives that are the same size. For your reference, I'll normally use the command 'ddrescue -v -r 3 /dev/sdb /dev/sdc example.log'.

I'd like to know if it's possible to do this with DDRescue. I've read the manual from GNU (http://www.gnu.org/software/ddrescue/manual/ddrescue_manual.html) and I haven't seen anything indicating that it is possible.

I'm just looking for some confirmation that this is a correct impression. If it's not possible, then it would be helpful if any of y'all would be able to make some work around suggestions. But please don't feel obligated to do that. I don't want to have my one thread bogged down with two many questions.

krebshackkrebshack

2 Answers

If you suspect this disk is on it's way out, your first priority should be to get the most important data off it imediatly, NOT trying to repair it or clone it. Again, don't try to clone it, but strategically attempt to move the most important data somehwere safe first, then go after the less important data later.

Attempting to clone the drive could not only result in catastrophic failure, but if the disk fails 99% of the way in duriong a clone attempt, not only is the disk now dead, but your image of the disc will most likley be worthless.

The beauty of this tool is that if there is a file on a bad sector, it'll keep on truckin' and not abort the whole process. Windows has a bad habit of aborting the whole operation if a file half way can't be read.

This way you can get the most important data first, and then get the other stuff. If by some miracle the disk survives this, try using imagex to capture an image, it's a filesystem based imaging tool, not a sector based imaging tool, you may have some luck.

MDT GuyMDT Guy
3,6531 gold badge14 silver badges37 bronze badges

Why not try Drive Image XML? It is much simpler and works with drives of different sizes.

Fasih KhatibFasih Khatib
4343 gold badges10 silver badges25 bronze badges

Not the answer you're looking for? Browse other questions tagged windows-7windowslinuxhard-drive or ask your own question.

GNU ddrescue Manual

This manual is for GNU ddrescue (version 1.24, 24 February 2019).

  • Introduction: Purpose and features of GNU ddrescue
  • Basic concepts: Blocks, clusters, devices, files, sectors, etc
  • Important advice: Read this or risk losing your data
  • Algorithm: How ddrescue recovers the data
  • Output: Meaning of ddrescue's screen output
  • Invoking ddrescue: Command line interface
  • Mapfile structure: Detailed format of the mapfile
  • Emergency save: Saving the mapfile in case of trouble
  • Optical media: Copying CD-ROMs and DVDs
  • Examples: A small tutorial with examples
  • Direct disc access: Bypassing the kernel cache
  • Command mode: Copying parts of the input file on demand
  • Fill mode: Selectively overwriting the output file
  • Generate mode: Generating an approximate mapfile
  • Ddrescuelog: Tool for ddrescue mapfiles
  • Invoking ddrescuelog: Command line interface
  • Problems: Reporting bugs
  • Concept index: Index of concepts
Copyright © 2004-2019 Antonio Diaz Diaz.

This manual is free documentation: you have unlimited permissionto copy, distribute and modify it.

Next: Basic concepts,Previous: Top,Up: Top

1 Introduction

GNU ddrescue is adata recovery tool. It copies data from one file or block device (hard disc,cdrom, etc) to another, trying to rescue the good parts first in case ofread errors.

The basic operation of ddrescue is fully automatic. That is, you don't haveto wait for an error, stop the program, restart it from a new position, etc.

If you use the mapfile feature of ddrescue, the data are rescued veryefficiently, (only the needed blocks are read). Also you may interrupt therescue at any time and resume it later at the same point. The mapfile is anessential part of ddrescue's effectiveness. Use it unless you know what youare doing.

Ddrescue does not write zeros to the output when it finds bad sectors in theinput, and does not truncate the output file if not asked to. So, every timeyou run it on the same output file, it tries to fill in the gaps withoutwiping out the data already rescued.

Automatic merging of backups: If you have two or more damaged copies of afile, cdrom, etc, and run ddrescue on all of them, one at a time, with thesame output file, you will probably obtain a complete and error-free file. This is so because the probability of having the same area damaged in allcopies is low (if the errors are randomly located). Using the mapfile, onlythe needed blocks are read from the second and successive copies.

Ddrescue recommends lzip forcompression of backups because the lzip format is designed for long-termarchiving and provides data recovery capabilities which nicely complementthose of ddrescue. (Ddrescue fills unreadable sectors with data from othercopies, while lziprecover corrects corrupt sectors with data from othercopies). If the cause of file corruption is damaged media, the combinationddrescue + lziprecover is the best option for recovering data frommultiple damaged copies. See lziprecover-example.

Because ddrescue needs to read and write at random places, it only works onseekable (random access) input and output files.

If your system supports it, ddrescue can use direct disc access to read theinput file, bypassing the kernel cache.

Ddrescue also features a 'fill mode' able to selectively overwrite parts ofthe output file, which has a number of interesting uses like wiping data,marking bad areas or even, in some cases, 'repair' damaged sectors.

One of the great strengths of ddrescue is that it is interface-agnostic, andso can be used for any kind of device supported by your kernel (ATA, SATA,SCSI, old MFM drives, floppy discs, or even flash media cards like SD).

Next: Important advice,Previous: Introduction,Up: Top

2 Basic concepts

Block
Any amount of data. A block is described by its starting position andits size. The starting position (or beginning position) is the lowestposition in the block. The end of the block is its starting positionplus its size.
Cluster
Group of consecutive sectors read or written in one go.
Device
Piece of hardware containing data. Hard disc drives, cdrom drives, USBpendrives, are devices. /dev/hda, /dev/sdb, are device names.
File
Files are named units of data which are stored by the operating systemfor you to retrieve later by name. Devices and partitions are accessedby means of their associated file names.
Partition
Every part in which a device is divided. A partition normally contains afile system. /dev/hda1, /dev/sdb3, are partition names.
Recoverable formats
As ddrescue uses standard library functions to read data from the devicebeing rescued, only mountable device formats can be rescued withddrescue. CD-ROMs and DVDs can be rescued, 'compact disc digital audio'CDs can't, 'video CDs'[1] maybe.
[1]http://en.wikipedia.org/wiki/Video_CD
Rescue domain
Block or set of blocks to be acted upon (rescued, listed, etc). You maydefine it with the options '--input-position', '--size' and'--domain-mapfile'. The rescue domain defaults to the whole inputfile or mapfile. If ddrescue can't determine the size of the input file,the rescue domain defaults to the maximum size of a block (at least2^63 - 1 bytes, or 8 EiB minus 1 byte).

Ddrescue will never try to read any data outside of the rescue domainexcept when unaligned direct disc access is requested (see Direct disc access). If it does, please, report it as a bug.

The amount of data rescued, number of bad areas, etc, shown by ddrescuemay vary or even become zero if you limit the rescue domain. Don'tworry, they have not disappeared; they are simply out of the specifiedrescue domain.

Sector
Hardware block. Smallest accessible amount of data on a device.

3 Using ddrescue safely

Ddrescue is like any other power tool. You need to understand what itdoes, and you need to understand some things about the machines it doesthose things to, in order to use it safely.

Never try to rescue a r/w mounted partition. The resulting copy may beuseless. It is best that the device or partition to be rescued is notmounted at all, not even read-only.

Never try to repair a file system on a drive with I/O errors; you willprobably lose even more data.

If you use a device or a partition as destination, any data stored therewill be overwritten.

Some systems may change device names on reboot (e.g. udev enabledsystems). If you reboot, check the device names before restartingddrescue.

If you interrupt the rescue and then reboot, any partially copiedpartitions should be hidden before allowing them to be touched by anyoperating system that tries to mount and 'fix' the partitions it sees.

Next: Output,Previous: Important advice,Up: Top

4 Algorithm

GNU ddrescue is not a derivative of dd, nor is related to dd in any wayexcept in that both can be used for copying data from one device toanother. The key difference is that ddrescue uses a sophisticatedalgorithm to copy data from failing drives causing them as littleadditional damage as possible.

Ddrescue manages efficiently the status of the rescue in progress andtries to rescue the good parts first, scheduling reads inside bad (orslow) areas for later. This maximizes the amount of data that can befinally recovered from a failing drive.

The standard dd utility can be used to save data from a failing drive,but it reads the data sequentially, which may wear out the drive withoutrescuing anything if the errors are at the beginning of the drive.

Other programs read the data sequentially but switch to small size readswhen they find errors. This is a bad idea because it means spending moretime at error areas, damaging the surface, the heads and the drivemechanics, instead of getting out of them as fast as possible. Thisbehavior reduces the chances of rescuing the remaining good data.

The algorithm of ddrescue is as follows (the user may interrupt theprocess at any point, but be aware that a bad drive can block ddrescuefor a long time until the kernel gives up):

1) Optionally read a mapfile describing the status of a multi-part orpreviously interrupted rescue. If no mapfile is specified or is empty ordoes not exist, mark all the rescue domain as non-tried.

2) (First phase; Copying) Copying is done in up to five passes. Thefirst pass reads the non-tried parts of the input file, marking thefailed blocks as non-trimmed and skipping beyond them. The second passdelimits the blocks skipped by the first pass. The first two passes alsoskip beyond slow areas. The skipped areas are tried later in one orthree additional passes (before trimming). The copying direction isreversed after each pass until all the rescue domain is tried.

The third and fourth passes read the blocks skipped due to slow areas(if any) by the first two passes, in the same direction that each blockwas skipped. For each block, passes 2 to 4 skip the rest of the blockafter finding the first error in the block. The last pass is a sweepingpass, with skipping disabled. The purpose of the multiple passes is todelimit large bad areas fast, recover the most promising areas first,keep the mapfile small, and produce good starting points for trimming.

Only non-tried areas are read in large blocks. Trimming, scraping andretrying are done sector by sector. Each sector is tried at most twotimes; the first in this phase as part of a large block read, the secondin one of the phases below as a single sector read.

3) (Second phase; Trimming) Trimming is done in one pass. For eachnon-trimmed block, read forwards one sector at a time from the leadingedge of the block until a bad sector is found. Then read backwards onesector at a time from the trailing edge of the block until a bad sectoris found. Then mark the bad sectors found (if any) as bad-sector, andmark the rest of the block as non-scraped without trying to read it. Ifany edge is already adjacent to a bad sector, it is considered asalready trimmed and is not trimmed again.

4) (Third phase; Scraping) Scrape together the data not recovered by thecopying or trimming phases. Scraping is done in one pass. Eachnon-scraped block is read forwards, one sector at a time. Any badsectors found are marked as bad-sector.

5) (Fourth phase; Retrying) Optionally try to read again the bad sectorsuntil the specified number of retry passes is reached. The direction isreversed after each pass. Every bad sector is tried only once in eachpass. Ddrescue can't know if a bad sector is unrecoverable or if it willbe eventually read after some retries.

6) Optionally write a mapfile for later use. When ddrescue finishes the steps above, any areas marked as bad-sector willremain untouched in the output file. If the output file is a regular filecreated by ddrescue, the areas marked as bad-sector will contain zeros. Ifit is a device or a previously existing file, the areas marked as bad-sectorwill still contain the data previously present there.

The mapfile is periodically saved to disc, as well as when ddrescue finishesor is interrupted. A backup copy of the mapfile with the extension'.bak' is also periodically created (if possible). So in case of acrash you can resume the rescue with little recopying. The default intervalbetween saves varies from 30 seconds to 5 minutes depending on mapfile size(larger mapfiles are saved at longer intervals), but may be overriden. See --mapfile-interval.

The same mapfile can be used for multiple commands that copy different areasof the input file, and for multiple recovery attempts over differentsubsets. See this example:

Rescue the most important part of the disc first.

Then rescue some key disc areas.

Now rescue the rest (does not recopy what is already done).

Next: Invoking ddrescue,Previous: Algorithm,Up: Top

5 Meaning of ddrescue's screen output

The output of ddrescue looks like this:

The meaning of each field is as follows:

ipos
Input position. The position in the input file where data are beingcurrently read from.
opos
Output position. The position in the output file where data are beingcurrently written to.
non-tried
Size of the part of the rescue domain pending to be tried. This is thesum of the sizes of all the non-tried blocks.
rescued
Size of the part of the rescue domain already successfully recovered. This is the sum of the sizes of all the finished blocks.
pct rescued
Percentage of the rescue domain that has been successfully recovered.
slow reads
Number of times that the read rate fell below '--min-read-rate'during the first two passes of the copying phase. See --min-read-rate.
tried
Size of the part of the rescue domain already tried but not yet rescued. This is the sum of the sizes of all the non-trimmed, non-scraped andbad-sector blocks.
non-trimmed
Size of the part of the rescue domain pending to be trimmed. This is thesum of the sizes of all the non-trimmed blocks.
non-scraped
Size of the part of the rescue domain pending to be scraped. This is thesum of the sizes of all the non-scraped blocks.
bad-sector
Total error size. This is the size of the part of the rescue domainformed by known bad sectors. The total error size is the sum of thesizes of all the bad-sector blocks. It increases during the trimming andscraping phases, and may decrease during the retrying phase. A sector isnot marked as bad-sector and considered part of a bad area until it hasbeen tried individually instead of as part of a large block read. Notethat as ddrescue retries the bad-sector blocks, the good data found maydivide them into smaller blocks, decreasing the total error size butincreasing the number of bad areas.
bad areas
Number of separate bad-sector blocks inside the rescue domain. Non-trimmed and non-scraped blocks are not considered bad areas. See --max-bad-areas.
read errors
Number of failed read attempts. See --max-error-rate.
current rate
The read rate measured during the last second.
average rate
The average read rate measured during the current run.
error rate
The read error rate measured during the last second.
run time
Time elapsed since the beginning of the current run.
remaining time
Estimated remaining time to rescue all the data in the rescue domain. The remaining time is calculated using the average rate of the last 30seconds and does not take into account that some parts of the rescuedomain may be excluded from the rescue (for example with'--no-trim'), or that some areas may be unrecoverable. Therefore itmay be very imprecise, may vary widely during the rescue, and may show anon-zero value at the end of the rescue. In particular it may go down toa few seconds at the end of the first pass, just to grow to hours ordays in the following passes. Such is the nature of ddrescue; the goodparts are usually recovered fast, while the rest may take a long time.
time since last successful read
Time elapsed since the last successful read attempt.

6 Invoking ddrescue

The format for running ddrescue is:

infile and outfile may be files, devices or partitions. mapfile is a regular file and must be placed in an existing directory. If mapfile does not exist, ddrescue will create it.

Ddrescue tries to create a backup copy of the mapfile, with the namemapfile.bak, every time it is going to overwrite a fsyncedmapfile. See --mapfile-interval.

Always use a mapfile unless you know you won't need it. Without a mapfile,ddrescue can't resume a rescue, only reinitiate it.

ddrescue supports the following options:

-h
--help
Print an informative help message describing the options and exit.
-V
--version
Print the version number of ddrescue on the standard output and exit. This version number should be included in all bug reports.


-a bytes
--min-read-rate=bytes
Minimum read rate of good non-tried areas, in bytes per second. If theread rate falls below this value during the first two passes of thecopying phase, ddrescue will skip ahead a variable amount depending onrate and error histories. The skipped blocks are tried in additionalpasses (before trimming).

If bytes is 0 (auto), the minimum read rate is recalculated everysecond as (average_rate / 10).

-A
--try-again
Mark all non-trimmed and non-scraped blocks inside the rescue domain asnon-tried before beginning the rescue. Try this if the drive stopsresponding and ddrescue immediately starts scraping failed blocks whenrestarted. If '--retrim' is also specified, mark all failed blocksinside the rescue domain as non-tried.
-b bytes
--sector-size=bytes
Sector (hardware block) size of input device in bytes (usually 512 forhard discs and 3.5' floppies, 1024 for 5.25' floppies, and 2048 forcdroms). Defaults to 512.
-B
--binary-prefixes
Show units with binary prefixes (powers of 1024).
SI prefixes (powers of 1000) are used by default. (See table below).
-c sectors
--cluster-size=sectors
Number of sectors to copy at a time. Defaults to 64 KiB / sector_size. Try smaller values for slow drives. The number of sectors per track (18or 9) is a good value for floppies.
-C
--complete-only
Limit rescue domain to the blocks listed in the mapfile. Don'tread new data beyond mapfile limits. This is useful when readingfrom devices of undefined size (like raw devices), when the drivereturns an incorrect size, or when reading from a partial copy. It canonly be used after a first rescue attempt, possibly limited with the'--size' option, has produced a complete mapfile.
-d
--idirect
Use direct disc access (see Direct disc access) to read frominfile, bypassing the kernel cache. (Opens the file with theO_DIRECT flag). Sector size must be correctly set for this to work. Notall systems support this.

If your system does not support direct disc access, ddrescue will warnyou. If the sector size is not correctly set, an unaligned read errorwill result and ddrescue will exit with status 1.

-D
--odirect
Use direct disc access to write to outfile, bypassing the kernelcache. (Opens the file with the O_DIRECT flag). Sector size must becorrectly set for this to work. Not all systems support this.

If your system does not support direct disc access, ddrescue will warnyou. If the sector size is not correctly set, a write error will resultand no data will be rescued. Some OSs have a bug that prevents them fromdetecting write errors properly (or at all) on some devices if directdisc access is not used for outfile.


-e [+]n
--max-bad-areas=[+]n
Maximum number of bad areas allowed before giving up. Defaults toinfinity. If n is preceded by '+' the number refers to newbad areas found in this run, not counting those already present in themapfile.


-E bytes
--max-error-rate=bytes
Maximum rate of read errors allowed before giving up, in bytes persecond. Defaults to infinity. The rate being measured is that ofactually failed reads, so ddrescue may exit because of this rate beingexceeded even if the total error size (size of bad-sector areas) doesnot change because the areas being tried are being marked as non-trimmedor non-scraped, or are already marked as bad-sector.
-f
--force
Force overwrite of outfile. Needed when outfile is not aregular file, but a device or partition. This option is just a safeguardto prevent the inadvertent destruction of partitions, and is ignored forregular files.
-F types
--fill-mode=types
Fill the blocks in outfile specified as any of types inmapfile, with data read from infile. types containsone or more of the status characters defined in the chapter Mapfilestructure (see Mapfile structure) and an optional 'l' forsector location data. See the chapter Fill mode (see Fill mode) fora complete description of the fill mode.
-G
--generate-mode
Generate an approximate mapfile from the infile andoutfile of the original rescue run. Note that you must keep theoriginal offset between '--input-position' and'--output-position' of the original rescue run. See the chapterGenerate mode (see Generate mode) for a complete description of thegenerate mode.
-H file
--test-mode=file
Builds a map of good/bad blocks using the mapfile file and uses itto simulate read errors in infile. The blocks marked as finishedin file will be read normally. All other block types will beconsidered read errors without even trying to read them frominfile. The apparent size of infile is truncated to theextent of file. This mode is an aid in improving the algorithm ofddrescue and is also useful to verify that ddrescue produces accurateresults in presence of read errors. Use '-' as file to readfrom standard input.
-i bytes
--input-position=bytes
Starting position of the rescue domain in infile, in bytes. Defaults to 0. This is not the point from which ddrescue starts copying. (For example, if you pass the '--reverse' option to ddrescue, itstarts copying from the end of the rescue domain). In fill mode itrefers to a position in the infile of the original rescue run. Seethe chapter Fill mode (see Fill mode) for details.
-I
--verify-input-size
Compare the size of infile with the size calculated from the listof blocks contained in the mapfile, and exit with status 1 if theydiffer. This is not enabled by default because the size of some devicescan't be known in advance and because the size derived from themapfile may be incomplete, for example after doing a partialrescue.
-J
--verify-on-error
After every read error, read again the last good sector found and verifythat it returns the same data. Exit with status 2 if the read fails orreturns inconsistent data. Exit with status 1 if a read error happensbefore a good sector is found.

This option performs one extra read after each error, wearing the drivefaster. Use it only on drives that stop responding or return garbagedata after finding errors. You may need to power cycle the drive beforerestarting ddrescue.

-K [initial][,max]
--skip-size=[initial][,max]
Set limits to skip size during the copying phase. At least one ofinitial or max must be specified. initial is the sizeto skip on the first read error or slow read, in bytes. max is themaximum size to skip. The values given will be rounded to the nextmultiple of sector size. The skip size will be doubled for each readerror or slow read until it reaches max or, if max isomitted, 1% of the size of infile, and will be reset toinitial when good data are found. Valid values range from 64 KiBto 1 EiB. initial defaults to infile_size / 100_000with a minimum value of 64 KiB. An initial value of 0 disablesskipping entirely.

If ddrescue is having difficulties skipping away from a large area withscattered errors, or if the device has large bad areas at regularintervals, you may increase the initial skip size with this option. Inversely, if ddrescue is skipping too much, leaving large non-triedareas behind each error (which will be read later in the usually slowerbackwards direction), you may reduce the maximum skip size, or disableskipping.

'--skip-size' is independent from '--cluster-size'. The sizeto skip is calculated from the end of the block that just failed.

-L
--loose-domain
Accept an incomplete synthetic (user fabricated) domain mapfile ortest-mode mapfile and fill the gaps in the list of data blocks withnon-tried blocks. The blocks in the mapfile must be strictly ascendingand non-overlapping, but they don't need to be contiguous. This optionallows making quick edits to a mapfile without all the size calculationsinvolved in making all data blocks contiguous again.


-m file
--domain-mapfile=file
Restrict the rescue domain to the blocks marked as finished in themapfile file. This is useful for merging partially recoveredimages of backups, or if the destination drive fails during the rescue. Use '-' as file to read the domain mapfile from standard input. Specialized tools like ddrutility or partclone can produce a domainmapfile listing all the used blocks in a partition, making the rescuemore efficient.
-M
--retrim
Mark all failed blocks inside the rescue domain as non-trimmed beforebeginning the rescue. The effect is similar to '--retry-passes=1',but the bad sectors are tried in a different order, making perhapspossible to rescue some of them.
-n

Games For Windows 7

--no-scrape
Skip the scraping phase. Avoids spending a lot of time trying to rescuethe most difficult parts of the file.
-N
--no-trim
Skip the trimming phase. Especially useful in the first parts of amulti-part rescue.
-o bytes
--output-position=bytes
Starting position of the image of the rescue domain in outfile, inbytes. Defaults to '--input-position'. The bytes below bytesaren't touched if they exist and truncation is not requested. Else theyare set to 0.
-O
--reopen-on-error
Close infile and then reopen it after every read error encounteredduring the copying phase. If '--min-read-rate' is set, also closeand reopen infile after every slow read encountered during thefirst two passes of the copying phase. Use this option if you notice apermanent drop in transfer rate after finding read errors or slow areas. But be warned that most probably the slowing-down is intentionallycaused by the kernel in an attempt to increase the probability ofreading data from the device.
-p
--preallocate
Preallocate space on disc for outfile. Only space for regularfiles can be preallocated. If preallocation succeeds, rescue will notfail due to lack of free space on disc. If ddrescue can't determine thesize to preallocate, you may need to specify it with some combination ofthe '--input-position', '--output-position', '--size',and '--domain-mapfile' options.
-P[lines]
--data-preview[=lines]
Show lines lines of the latest data read in '16-byte hex + ASCII' format. Valid values for lines range from 1 to 32. Iflines is omitted, a default value of 3 is used.
-q
--quiet
Quiet operation. Suppress all messages.
-r n
--retry-passes=n
Exit after the given number of retry passes. Defaults to 0. -1 meansinfinity. Every bad sector is tried only once in each pass. To retry badsectors detected on a previous run, you must specify a non-zero numberof retry passes.
-R
--reverse
Reverse the direction of all passes (copying, trimming, scraping andretrying). Every pass that is normally run forwards will now be runbackwards, and vice versa. '--reverse' does not modify the size ofthe blocks copied during each phase, just the order in which they aretried.
-s bytes
--size=bytes
Maximum size of the rescue domain in bytes. It limits the amount ofinput data to be copied. If ddrescue can't determine the size of theinput file, you may need to specify it with this option. Note that thisoption does not specify the size of the resulting outfile. Forexample, the following command creates an outfile 300 bytes long,but only writes data on the last 200 bytes:
-S
--sparse
Use sparse writes for outfile. (The blocks of zeros are notactually allocated on disc). May save a lot of disc space in some cases. Not all systems support this. Only regular files can be sparse.
-t
--truncate
Truncate outfile to zero size before writing to it. Only works forregular files, not for drives or partitions.
-T interval
--timeout=interval
Maximum time since last successful read allowed before giving up. Defaults to infinity. interval is an integer or rational number(like 1.5 or 1/2) optionally followed by one of 's', 'm','h' or 'd', meaning seconds, minutes, hours and daysrespectively. If no unit is specified, it defaults to seconds. interval has a resolution of one second; fractions of a second arenot allowed.
-u
--unidirectional
Run all passes in the same direction. Forwards by default, or backwardsif the option '--reverse' is also given.
-v
--verbose
Verbose mode. Further -v's (up to 4) increase the verbosity level.
-w
--ignore-write-errors
Make fill mode ignore write errors. This is useful to avoid ddrescueexiting because of new bad sectors developing while wiping the goodsectors of a failing drive. Fill mode normally writes to outfileone cluster at a time. With this option, after the first write error isfound in an area, the rest of that area is filled sector by sector.

Note that in rescue mode a write error is fatal, which means that therescue needs to be repeated or else outfile needs to be copied toa third drive using mapfile as domain (see --domain-mapfile).

-x bytes
--extend-outfile=bytes
Extend the size of outfile to make it at least bytes long. If the size of outfile is already equal or longer than bytesthen this option does nothing. Use this option to guarantee a minimumsize for outfile. Only regular files can be extended.
-X n
--max-read-errors=n
Maximum number of read errors allowed before giving up. Defaults toinfinity. Exit with status 1 if more than n read errors areencountered. '--max-read-errors=0' is similar but different to'--timeout=0', which waits until the screen status is refreshed (atleast 1 second). If there is at least one successful read per second,'--timeout=0' does not make ddrescue to exit.

'--max-read-errors=0' is also similar but different to'--max-bad-areas=+0', which exits when a new bad area is found. Ifthe read errors are adjacent to existing bad areas, no new bad areas areproduced (just enlarged), and '--max-bad-areas=+0' does not makeddrescue to exit.

-y
--synchronous
Use synchronous writes for outfile. (Issue a fsync call afterevery write). May be useful when forcing the drive to remap its badsectors.
-Z bytes
--max-read-rate=bytes
Maximum read rate, in bytes per second. If bytes is too small, theactual read rate is rounded up to the equivalent of a whole number ofcluster reads per second. Use this option to limit the bandwidth used byddrescue, for example when recovering over a network.
--ask
Ask for user confirmation before starting the copy. If the first letterof the answer is 'y', ddrescue starts copying. Else it exits withstatus 1.
If they can be obtained, ddrescue shows the model and serial number ofthe input and output devices. Ddrescue also shows the size in bytes ofthe corresponding file or device if it exists. The format used is[model::serial_number] (size)
--command-mode
Read commands from the standard input and execute them, copying parts of theinput file on demand. Command line arguments controling the display (like'--data-preview') or the automatic algorithm (like '--max-errors'or '--reverse') have no effect in command mode. See Command mode,for a complete description of the command mode.
--cpass=range
Select what pass(es) to run during the copying phase. Valid pass valuesrange from 1 to 5. To run only the given pass(es), specify also'--no-trim' and '--no-scrape'. '--cpass=0' skips thecopying phase entirely.
Examples of rangePasses run
1 1
1,2,3 1, 2 and 3
2-4 2, 3 and 4
1,3-5 1, 3, 4 and 5
1-3,5 1, 2, 3 and 5

--delay-slow=interval
Initial delay before ddrescue starts checking for slow reads. Defaultsto 30 seconds. interval is formatted as in the option'--timeout' above.
--log-events=file
Log all significant events (start of each pass and end of run) infile. If file already exists, the new events are appended atthe end of file. For each event a line is printed containing atime stamp, the percentage rescued and a message describing the event. The 'end of run' line also contains the current position andstatus. If ddrescue exits because of an error or interruption, the causeis also logged in file.
--log-rates=file
Log rates and error sizes every second in file. If filealready exists, it will be overwritten. Every time the screen is updatedwith new details, some of those details (time, input position, currentand average rates, number of bad areas and total error size) are writtento file in a format usable by plotting utilities like gnuplot. This allows a posterior analysis of the drive to see if it has any weakzones (areas where the transfer rate drops well below the sustainedaverage).
--log-reads=file
Log all read operations in file. If file already exists, itwill be overwritten. Every read attempt and its result (position, size,copied size and error size) is written to fileDdrescue For Windows 7. (The positionwritten is always the beginning of the block tried, even if readingbackwards). A line is also written at the beginning of each phase(copying, trimming, scraping and retrying). Finally, a line with a timemark is written every second (unless the read takes more time). Use thisoption with caution because file may become very large veryquickly. Use lzip to compress file if you need to store ortransmit it.


--mapfile-interval=[save_interval][,sync_interval]
Change the interval at which ddrescue saves and fsyncs the mapfile. Atleast one of save_interval or sync_interval must be specified. Asave_interval of -1 chooses the default automatic interval (from 30seconds to 5 minutes depending on mapfile size). A save_interval of 0saves the mapfile after every read (use with caution). sync_interval is the interval between fsync calls. Defaultsync_interval is 5 minutes. Minimum sync_interval is 5 seconds. Intervals are formatted as in the option '--timeout' above.
--max-slow-reads=n
Maximum number of slow reads allowed before giving up. Defaults toinfinity. Exit with status 1 if more than n slow reads areencountered during the first two passes of the copying phase. Only worksif a minimum read rate has been set with '--min-read-rate'.
--pause-on-error=interval
Time to wait after each read error or slow read. Defaults to 0. interval is formatted as in the option '--timeout' above. Ifinterval begins with 's', the pause is simulated andinterval can be smaller than one second; the time displayed isincreased by interval but without performing any pause. Pausesimulation can be useful in combination with '--test-mode' fortesting purposes.
--pause-on-pass=interval
Time to wait between passes. Defaults to 0. interval is formattedas in the option '--timeout' above.
--reset-slow
Reset the slow reads counter every time the read rate reaches orsurpasses '--min-read-rate'. With this option, ddrescue only exitsafter the read rate has remained below '--min-read-rate' for atleast as many seconds as the argument given to '--max-slow-reads'.
--same-file
Allow infile and outfile to be the same file or device. Thismay be used to test the writing ability of a drive. It may also be usedto copy part of a file to another location inside or beyond the end ofthe same file by setting different values for '--input-position'and '--output-position'. If the data to be copied overlap with thedestination, the right copying direction must be chosen to avoidoverwriting the overlapping part before it is copied.

Numbers given as arguments to options (positions, sizes, rates, etc) maybe expressed as decimal, hexadecimal or octal values (using the samesyntax as integer constants in C++), and may be followed by a multiplierand an optional 'B' for 'byte'. The 's' multiplier may beappended to any of the other multipliers. For example, 'ks' meanskilosectors (1000 * sector_size), and 'Kis' means kibisectors(1024 * sector_size).

Table of SI and binary prefixes (unit multipliers):

Prefix Value | Prefix Value
s sectors |
k kilobyte (10^3 = 1000) | Ki kibibyte (2^10 = 1024)
M megabyte (10^6) | Mi mebibyte (2^20)
G gigabyte (10^9) | Gi gibibyte (2^30)
T terabyte (10^12) | Ti tebibyte (2^40)
P petabyte (10^15) | Pi pebibyte (2^50)
E exabyte (10^18) | Ei exbibyte (2^60)
Z zettabyte (10^21) | Zi zebibyte (2^70)
Y yottabyte (10^24) | Yi yobibyte (2^80)
Exit status: 0 for a normal exit, 1 for environmental problems (file notfound, invalid flags, I/O errors, etc), 2 to indicate a corrupt orinvalid input file, 3 for an internal consistency error (eg, bug) whichcaused ddrescue to panic.

If ddrescue is interrupted by a signal, it updates mapfile andthen terminates by raising the signal received.

Next: Emergency save,Previous: Invoking ddrescue,Up: Top

7 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 threeparts, the heading comments, the status line, and the list of datablocks. The character '#' at begin of line or after whitespacestarts a comment that extends to the end of the line.

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

The first non-comment line is the status line. It contains anon-negative integer, a status character, and a positive decimalinteger. The first integer is the position being tried in the inputfile. (The beginning of the block being tried in a forward pass or theend of the block in a backward pass). The status character is one ofthese:

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

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

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

Every line in the list of data blocks describes a block of data. Itcontains 2 non-negative integers and a status character. The firstinteger is the starting position of the block in the input file, thesecond integer is the size (in bytes) of the block. The status characteris 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:

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

Next: Optical media,Previous: Mapfile structure,Up: Top

8 Saving the mapfile in case of trouble

The mapfile is an essential part of ddrescue's effectiveness. Without amapfile, ddrescue can't resume a rescue, only reinitiate it. Given thata difficult rescue may take days to complete, it would be a seriousdrawback if the mapfile were lost because of a solvable problem like alack of space on the device the mapfile is written to.

In case of trouble writing the mapfile, ddrescue will print a messagelike this:

You may try to fix the problem, for example deleting some files to makeroom for the mapfile, and press <Return> to retry.

If the problem can't be fixed, you may press <e> followed by<Return> to try an emergency save and exit. Ddrescue will try towrite the mapfile to the file ddrescue.map in the currentdirectory or, if this fails, to $HOME/ddrescue.map. If themapfile is written succesfully, ddrescue will exit with status 1. Elseit will print the above message again.

Or you may press <q> followed by <Return> to quit and exit withstatus 1. In this case the contents of the mapfile will be lost.

9 Copying CD-ROMs and DVDs

Ddrescue may be better than dd for copying recordable CD-ROMs becausethe two lead out sectors at the end of some of them may cause a readerror that prevents the whole last record from being copied by dd,potentially losing data. Also dd may create an image larger than theoriginal if the 'sync' conversion and a block size larger than thesector size are specified.

In the special case of reading CD-ROMs (but not DVDs), the specializedtool dvdisaster may be a better option than ddrescue for recovering databecause dvdisaster can read and analyze raw CD sectors, which ddrescuecan't.

Recordable CD and DVD media keep their data only for a finite time(typically for some years). After that time, data loss develops slowly withread errors growing from the outer media region towards the inside. It is agood idea to make two (or more) copies of every important CD-ROM/DVD youburn so that you can later recover them with ddrescue.

If you have only one copy of a CD-ROM or DVD that fails when beingcopied, and if you have access to multiple optical media drives, youhave a better chance of recovering the bad sectors since one drive mayfail to read a particular sector, but another drive might be able tosqueeze the data out of it, depending on the laser frequency and thesensitivity of the laser-sensor that reads the reflected laser light. Example 1: Rescue a CD-ROM in /dev/cdrom. Example 2: Rescue a CD-ROM in /dev/cdrom from two copies. Example 3: Rescue a CD-ROM in /dev/cdrom using two CD drives from twodifferent computers, writing the image into an USB drive mounted on/mnt/mem. Example 4: Merge the partially recovered images of 3 identical DVDsusing their mapfiles as domain mapfiles. Example 5: Rescue a lzip compressed backup from two copies on CD-ROMwith error-checked merging of copies. See thelziprecover manualfor details about lziprecover.

Next: Direct disc access,Previous: Optical media,Up: Top

10 A small tutorial with examples

This tutorial is for those already able to use the dd command. If youdon't know what dd is, better search the net for some introductorymaterial about dd and GNU ddrescue first.

A failing drive tends to develop more and more errors as time passes. Because of this, you should rescue the data from a drive as soon as younotice the first error. Be diligent because every time a physicallydamaged drive powers up and is able to output some data, it may be thevery last time that it ever will.

You should make a copy of the failing drive with ddrescue, and then tryto repair the copy. If your data are really important, use the first copyas a master for a second copy, and try to repair the second copy. Ifsomething goes wrong, you have the master intact to try again.

If you are trying to rescue a whole partition, first repair the copywith e2fsck or some other tool appropriate for the type of partition youare trying to rescue, then mount the repaired copy somewhere and try torecover the files in it.

If the drive is so damaged that the file system in the rescued partitioncan't be repaired or mounted, you will have to browse the rescued datawith an hex editor and extract the desired parts by hand or use a filerecovery tool like photorec.

If the partition table is damaged, you may try to rescue the whole disc,then try to repair the partition table and the partitions on the copy.

If the damaged drive is not listed in /dev, then you cannot rescue it. At least not with ddrescue.

See Optical media, for rescue examples of CD-ROMs and DVDs. Example 1: Fully automatic rescue of a whole disc with two ext2partitions in /dev/sda to /dev/sdb.
Note: you don't need to partition /dev/sdb beforehand, but if thepartition table on /dev/sda is damaged, you'll need to recreate itsomehow on /dev/sdb. Example 2: Rescue an ext2 partition in /dev/sda2 to /dev/sdb2.
Note: you need to create the sdb2 partition with fdisk first. sdb2should be of appropriate type and size. Example 3: While rescuing the whole drive /dev/sda to /dev/sdb, /dev/sdafreezes up at position 12345678. Example 4: While rescuing the whole drive /dev/sda to /dev/sdb, /dev/sdbfails and you have to rescue data to a third drive, /dev/sdc. Example 5: While rescuing a partition in /dev/sda1 to the file hdimage,/dev/sda1 stops responding and begins returning read errors, causingddrescue to mark the rest of the partition as non-scraped. Example 6: While rescuing a partition in /dev/sda1 to the file hdimage,sda1 disappears from /dev. Example 7: While rescuing a partition in /dev/sda1 to the file hdimage,the partition table of /dev/sda becomes unreadable and the OS no longershows sda1 in /dev. The solution is to shift the mapfile and read therest of the partition sda1 from /dev/sda. Note: you need to know the offset of the partition sda1 in the drive sdaand the size of sda1. Example 8: After rescuing a partition in /dev/sda1 to the file hdimage,expand hdimage to copy the whole drive in /dev/sda without recopying thealready copied partition /dev/sda1. The solution is to shift themapfile, move the data of sda1 to its final position in hdimage, andthen read the rest of the data from /dev/sda. Note: you need to know the offset of the partition sda1 in the drive sdaand the size of sda1.

11 Direct disc access

If you notice that the positions and sizes in mapfile are alwaysmultiples of the sector size, maybe your kernel is caching the discaccesses and grouping them. In this case you may want to use direct discaccess for infile, or read from a raw device, to bypass the kernelcache and rescue more of your data.

NOTE! Sector size must be correctly set with the '--sector-size'option for direct disc access to work.

NOTE: Direct disc access can copy arbitrary domains by reading wholesectors and then writing only the requested part. This is the only casewhere ddrescue will try to read data outside of the rescue domain.

Try the '--idirect' option first. If direct disc access is notavailable in your system, try raw devices. Read your systemdocumentation to find how to bind a raw device to a regular blockdevice. Some OSs provide raw access through especial device names, like/dev/rdisk.

Ddrescue aligns its I/O buffer to the sector size so that it can be used fordirect disc access or to read from raw devices. For efficiency reasons, alsoaligns it to the memory page size if page size is a multiple of sector size. On some systems, ddrescue can't determine the size of a raw device, so anexplicit '--size' or '--complete-only' option may be needed.

Using direct disc access, or reading from a raw device, may be slower orfaster than normal cached reading depending on your OS and hardware. Incase it is slower you may want to make a first pass using normal cachedreads and use direct disc access, or a raw device, only to recover thegood sectors inside the failed blocks. Example 1: using direct disc access. Example 2: using a raw device.

Next: Fill mode,Previous: Direct disc access,Up: Top

12 Copying parts of the input file on demand

The command mode of ddrescue implements a scripting interface similar tothe one of ed. In this mode commands are read from the standard input and executed to copyparts of the input file to the output file, retrieve information from themapfile or write the mapfile to disc. Ddrescue's responses are written tostandard output. 'donen' for a successfully executed command, 'errorn' fora failed command (for example because of wrong arguments), and'error: error messagen' for serious or fatal errors like writeerrors.

If end-of-file is detected on standard input, ddrescue discards any partialcommand being read and executes a f command.

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

c possize
Copy command. Copies a block of data from infile to outfile andupdates the internal copy of the mapfile. The areas already marked asfinished in the mapfile are not copied again.
f
Finish command. Compacts the internal copy of the mapfile and writes it tomapfile (if it was specified in the command line). Then prints'donen' to standard output and quits. On startup, the mapfile is firstcompacted and then split following the rescue domain borders. The finishcommand compacts the mapfile again before exiting. If writing mapfileto disc fails, a non-interactive emergency save is tried before exiting. See Emergency save.
q
Quit command. Exits ddrescue. Does not update the mapfile.
s possize
Status command. Writes to standard output one or more lines in mapfileformat (see Mapfile structure), showing the status of the areas includedin the block requested. A line consisting of the string 'done' marks the endof the list.
u
Update mapfile command. Writes the internal copy of the mapfile tomapfile (if it was specified in the command line). If update mapfilefails, you may try to fix the problem, for example deleting some files tomake room for mapfile, before trying to update it again.
Next: Generate mode,Previous: Command mode,Up: Top

13 Fill mode

When ddrescue is invoked with the '--fill-mode' option it operatesin 'fill mode', which is different from the default 'rescue mode'. Thatis, if you use the '--fill-mode' option, ddrescue does not rescueanything. It only fills with data read from infile the blocks ofoutfile whose status character from mapfile coincides withone of the type characters specified as argument to the'--fill-mode' option.

If the argument of the '--fill-mode' option contains an 'l',ddrescue will write location data (position, sector number and status)into each sector filled. With bad sectors filled in this way, it shouldbe possible to retry the recovery of important files, as location of theerror is known by looking into the unfinished copy of the file.

In fill mode infile does not need to be seekable and it may be ofany size. If it is too small, the data will be duplicated as many timesas necessary to fill the input buffer. If it is too big, only the dataneeded to fill the input buffer will be read. Then the same data will bewritten to every cluster or sector to be filled.

Note that in fill mode infile is always read from position 0. Ifyou specify a '--input-position', it refers to the originalinfile from which mapfile was built, and is only used tocalculate the offset between input and output positions.

Note also that when filling the infile of the original rescue runyou should not set '--output-position', whereas when filling theoutfile of the original rescue run you should keep the originaloffset between '--input-position' and '--output-position'.

The '--fill-mode' option implies the '--complete-only' option.

In fill mode mapfile is updated to allow resumability wheninterrupted or in case of a crash, but as nothing is being rescuedmapfile is not destroyed. The status line is the only part ofmapfile 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 whenexamined in an hex editor. For example, the following command line fillsall blocks marked as '-' (bad-sector) with copies of the string'BAD-SECTOR ':

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 especiallyuseful when sending the drive back to the manufacturer for warrantyreplacement.

Example 3: Force the drive to remap the bad sectors, making it usableagain. If the drive has only a few bad sectors, and they are not causedby drive age, you can probably just rewrite those sectors, and the drivewill reallocate them automatically to new 'spare' sectors that it keepsfor just this purpose. WARNING! This may not work on your drive. Fill mode can also help you to figure out, independently of the filesystem used, what files are partially or entirely in the bad areas ofthe disc. Just follow these steps:

1) Copy the damaged drive with ddrescue until finished. Don't use sparsewrites. This yields a mapfile containing only finished ('+') andbad-sector ('-') blocks.

2) Fill the bad-sector blocks of the copied drive or image file with astring not present in any file, for example 'DEADBEEF'. Use'--fill-mode=l-' if you want location data.

3) Mount the copied drive (or the image file, via loopback device)read-only.

4) Grep for the fill string in all the files. Those files containing thestring reside (at least partially) in damaged disc areas. Note that ifall the damaged areas are in unused space, grep will not find the stringin any file, which means that no files are damaged.

5) Take note of the location data of any important files that you wantto retry.

6) Unmount the copied drive or image file.

7) Retry the sectors belonging to the important files until they arerescued or until it is clear that they can't be rescued.

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

Example 4: Figure out what files are in the bad areas of the disc.

14 Generate mode

When ddrescue is invoked with the '--generate-mode' option itoperates in 'generate mode', which is different from the default 'rescuemode'. That is, if you use the '--generate-mode' option, ddrescuedoes not rescue anything. It only tries to generate a mapfile forlater use.

So you didn't read the manual and started ddrescue without amapfile. Now, two days later, your computer crashed and you can'tknow how much data ddrescue managed to save. And even worse, you can'tresume the rescue; you have to restart it from the very beginning.

Or maybe you started copying a drive with dd conv=noerror,sync and are now in the same situation described above. In this case, note that you can't use a copy made by dd unless it wasinvoked with the 'sync' conversion argument.

Don't despair (yet). Ddrescue can in some cases generate an approximatemapfile, from infile and the (partial) copy inoutfile, that is almost as good as an exact mapfile. Itmakes this by simply assuming that sectors containing all zeros were notrescued.

However, if the destination of the copy was a drive or a partition, (oran existing regular file and truncation was not requested), mostprobably you will need to restart ddrescue from the very beginning. (This time with a mapfile, of course). The reason is that old datamay be present in the drive that have not been overwritten yet, and maybe thus non-tried but non-zero.

For example, if you first tried one of these commands:

then you can generate an approximate mapfile with this command:

Note that you must keep the original offset between'--input-position' and '--output-position' of the originalrescue run.

Next: Invoking ddrescuelog,Previous: Generate mode,Up: Top

15 Ddrescuelog

Ddrescuelog is a tool that manipulates ddrescue mapfiles, shows mapfilecontents, converts mapfiles to/from other formats, compares mapfiles, testsrescue status, and can delete a mapfile if the rescue is done. Ddrescuelogoperations can be restricted to one or several parts of the mapfile if thedomain setting options are used.

When performing logic operations (AND, OR, XOR) on mapfiles of differentextension, only the blocks present in both files are processed.

Here are some examples of how to use ddrescuelog, alone or in combinationwith other tools. Example 1: Delete the mapfile if the rescue is finished (all data havebeen recovered without errors left). Example 2: Rescue two ext2 partitions in /dev/sda to/dev/sdb and repair the file systems using badblock lists generated withddrescuelog. File system block size is 4096.
Note: you do need to partition /dev/sdb beforehand. Example 3: Rescue a whole disc with two ext2 partitions in /dev/sda to/dev/sdb and repair the file systems using badblock lists generated withddrescuelog. Disc sector size is 512, file system block size is 4096. Arguments to options '-i' and '-s' are the starting positionsand sizes of the partitions being rescued.
Note: you don't need to partition /dev/sdb beforehand, but if thepartition table on /dev/sda is damaged, you'll need to recreate itsomehow on /dev/sdb.

16 Invoking ddrescuelog

The format for running ddrescuelog is:

Use '-' as mapfile to read the mapfile from standard input(also in the options taking a mapfile argument) or to write the mapfilecreated by '--create-mapfile' to standard output.

Ddrescuelog supports the following options:

-h
--help
Print an informative help message describing the options and exit.
-V
--version
Print the version number of ddrescuelog on the standard output and exit. This version number should be included in all bug reports.
-a old_types,new_types
--change-types=old_types,new_types
Change the status of every block in the rescue domain from one type inold_types to the corresponding type in new_types, much likethe 'tr' command does, and write the resulting mapfile to standardoutput. old_types and new_types are strings of block statuscharacters as defined in the chapter Mapfile structure (see Mapfile structure). Blocks whose status is not in old_types are leftunchanged. If new_types is shorter than old_types the lasttype of new_types is repeated as many times as necessary.
-A
--annotate-mapfile
Add comments containing the human-readable positions and sizes of theblocks in mapfile which are included in the rescue domain, andwrite the resulting mapfile to standard output.
-b bytes
--block-size=bytes
Block size used by ddrescuelog. Depending on the requested operation itmay be the sector size of the input device, the block size of therescued file system, etc. Defaults to 512.
-B
--binary-prefixes
Show units with binary prefixes (powers of 1024).
SI prefixes (powers of 1000) are used by default. (See table above,Invoking ddrescue).
-c[type1type2]
--create-mapfile[=type1type2]
Create a mapfile from a list of block numbers read from standardinput. Only blocks included in the rescue domain will be added tomapfile.

type1 and type2 are block status characters as defined inthe chapter Mapfile structure (see Mapfile structure). type1sets the type for blocks included in the list, while type2 setsthe type for the rest of mapfile. If not specified, type1defaults to '+' and type2 defaults to '-'.

-C[type]
--complete-mapfile[=type]
Complete a synthetic (user fabricated) mapfile by filling the gapswith blocks of type type, and write the completed mapfile tostandard output. type is one of the block status charactersdefined in the chapter Mapfile structure (see Mapfile structure). Iftype is not specified, the gaps are filled with non-tried blocks. All gaps in mapfile are filled. Domain options are ignored.
-d
--delete-if-done
Delete the given mapfile if all the blocks in the rescue domainhave been successfully recovered. The exit status is 0 if mapfilecould be deleted, 1 otherwise.
-D
--done-status
Test if all the blocks in the rescue domain have been successfullyrecovered. The exit status is 0 if all tested blocks are finished, 1otherwise.
-f
--force
Force overwrite of mapfile.
-i bytes
--input-position=bytes

Yahoo Messenger For Windows 7

Starting position of the rescue domain, in bytes. Defaults to 0. Itrefers to a position in the original infile.
-l types
--list-blocks=types
Print on standard output the block numbers of the blocks specified asany of types in mapfile and included in the rescue domain. types contains one or more of the block status characters definedin the chapter Mapfile structure (see Mapfile structure).

The list format is one block number per line in decimal, like the outputof the badblocks program, so that it can be used as input for e2fsck orother similar filesystem repairing tool.

-L
--loose-domain
Accept an incomplete synthetic (user fabricated) domain mapfile orcompare-as-domain mapfile and fill the gaps in the list of data blockswith non-tried blocks. The blocks in the mapfile must be strictlyascending and non-overlapping, but they don't need to be contiguous. This option allows making quick edits to a mapfile without all the sizecalculations involved in making all data blocks contiguous again.
-m file
--domain-mapfile=file
Restrict the rescue domain to the blocks marked as finished in themapfile file.
-n
--invert-mapfile
Invert the types of the blocks in mapfile which are included inthe rescue domain, and write the resulting mapfile to standard output. Finished blocks ('+') are changed to bad-sector ('-'), allother types are changed to finished. '--invert-mapfile' isequivalent to '--change-types=?*/-+,++++-'
-o bytes
--output-position=bytes
Starting position of the image of the rescue domain in the originaloutfile, in bytes. Is used by the '--list-blocks' option. Defaults to '--input-position'.
-p file
--compare-mapfile=file
Compare the types of the blocks included in the rescue domain. The exitstatus is 0 if all the blocks tested are the same in both file andmapfile, 1 otherwise.
-P file
--compare-as-domain=file
Compare only the blocks marked as finished in the rescue domain. Theexit status is 0 if all the blocks tested are the same in bothfile and mapfile, 1 otherwise. Two files comparing equalwith this option are equivalent when used as domain mapfiles.
-q
--quiet
Quiet operation. Suppress all messages.
-s bytes
--size=bytes
Maximum size of the rescue domain in bytes. It refers to a size in theoriginal infile.
-t
--show-status
Print a summary of the contents of each mapfile to the standardoutput. This option allows more than one mapfile. If the domainsetting options are used, the summary can be restricted to one orseveral parts of mapfile.
-v
--verbose
Verbose mode. Further -v's (up to 4) increase the verbosity level.
-x file
--xor-mapfile=file

Ddrescue For Windows 7

Perform a logical XOR (exclusive OR) operation between the finishedblocks in file and those in mapfile, and write the resultingmapfile to standard output. In other words, in the resulting mapfile ablock is only shown as finished if it was finished in either of the twoinput mapfiles but not in both.
-y file
--and-mapfile=file
Perform a logical AND operation between the finished blocks infile and those in mapfile, and write the resulting mapfileto standard output. In other words, in the resulting mapfile a block isonly shown as finished if it was finished in both input mapfiles.
-z file
--or-mapfile=file
Perform a logical OR operation between the finished blocks in fileand those in mapfile, and write the resulting mapfile to standardoutput. In other words, in the resulting mapfile a block is shown asfinished if it was finished in either of the two input mapfiles.
--shift
Shift the positions of all the blocks in mapfile by the offset('--output-position' - '--input-position'), and write theresulting mapfile to standard output. Either '--input-position' or'--output-position' must be 0. If the offset is positive, anon-tried block is inserted before the first block. Any blocks beyondthe end of the rescue domain are removed before performing the shift.

Exit status: 0 for a normal exit, 1 for environmental problems (file notfound, invalid flags, I/O errors, etc), 2 to indicate a corrupt orinvalid input file, 3 for an internal consistency error (eg, bug) whichcaused ddrescuelog to panic.

Next: Concept index,Previous: Invoking ddrescuelog,Up: Top

17 Reporting bugs

There are probably bugs in ddrescue. There are certainly errors andomissions in this manual. If you report them, they will get fixed. Ifyou don't, no one will ever know about them and they will remain unfixedfor all eternity, if not longer.

If you find a bug in GNU ddrescue, please send electronic mail tobug-ddrescue@gnu.org. Include the version number, which you canfind by running ddrescue --version.

Concept index