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.
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.
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 GuyWhy not try Drive Image XML? It is much simpler and works with drives of different sizes.
Fasih KhatibFasih KhatibNot 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
This manual is free documentation: you have unlimited permissionto copy, distribute and modify it.
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).
2 Basic concepts
[1]http://en.wikipedia.org/wiki/Video_CD
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.
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.
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).
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
-V
--version
-a
bytes--min-read-rate=
bytesIf bytes is 0 (auto), the minimum read rate is recalculated everysecond as (average_rate / 10).
-A
--try-again
-b
bytes--sector-size=
bytes-B
--binary-prefixes
SI prefixes (powers of 1000) are used by default. (See table below).
-c
sectors--cluster-size=
sectors-C
--complete-only
-d
--idirect
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
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-E
bytes--max-error-rate=
bytes-f
--force
-F
types--fill-mode=
types-G
--generate-mode
-H
file--test-mode=
file-i
bytes--input-position=
bytes-I
--verify-input-size
-J
--verify-on-error
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]
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
-m
file--domain-mapfile=
file-M
--retrim
-n
Games For Windows 7
--no-scrape
-N
--no-trim
-o
bytes--output-position=
bytes-O
--reopen-on-error
-p
--preallocate
-P[
lines]
--data-preview[=
lines]
-q
--quiet
-r
n--retry-passes=
n-R
--reverse
-s
bytes--size=
bytes-S
--sparse
-t
--truncate
-T
interval--timeout=
interval-u
--unidirectional
-v
--verbose
-w
--ignore-write-errors
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-X
n--max-read-errors=
n'--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
-Z
bytes--max-read-rate=
bytes--ask
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
--cpass=
rangeExamples of range | Passes 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--log-events=
file--log-rates=
file--log-reads=
file--mapfile-interval=[
save_interval][,
sync_interval]
--max-slow-reads=
n--pause-on-error=
interval--pause-on-pass=
interval--reset-slow
--same-file
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) |
If ddrescue is interrupted by a signal, it updates mapfile andthen terminates by raising the signal received.
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.
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.
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.
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.
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.
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
-V
--version
-a
old_types,
new_types--change-types=
old_types,
new_types-A
--annotate-mapfile
-b
bytes--block-size=
bytes-B
--binary-prefixes
SI prefixes (powers of 1000) are used by default. (See table above,Invoking ddrescue).
-c[
type1type2]
--create-mapfile[=
type1type2]
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]
-d
--delete-if-done
-D
--done-status
-f
--force
-i
bytes--input-position=
bytesYahoo Messenger For Windows 7
-l
types--list-blocks=
typesThe 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
-m
file--domain-mapfile=
file-n
--invert-mapfile
-o
bytes--output-position=
bytes-p
file--compare-mapfile=
file-P
file--compare-as-domain=
file-q
--quiet
-s
bytes--size=
bytes-t
--show-status
-v
--verbose
-x
file--xor-mapfile=
fileDdrescue For Windows 7
-y
file--and-mapfile=
file-z
file--or-mapfile=
file--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.
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
- : Mentor Graphics Expedition Pcb Free Download
- : Mt Power Drum Kit Crack
- : Format Sff Style Dangdut
- : Game Simulator Bus Versi Indonesia
- : I Came To Play The Science Of Rhythm Guitar Library
- : Dos Wooden Shjips Rar
- : Nmd Vpn Setup Download
- : Sterrad 100s User Manual
- : Free Graphics Software For Mac Os X