Cloning and Rescuing Disks With dd and ddrescue
One tool for a healthy clone, a different one for a dying disk

Contents
I’ve used dd to clone a boot drive to a bigger one, and I’ve used ddrescue to pull a dying laptop disk back from the edge with a client’s decade of photos on it. They look similar on the command line — both read blocks from one device and write them to another — and treating them as interchangeable is how people lose data they could have kept. dd assumes the source disk cooperates. ddrescue assumes it doesn’t, and is built entirely around that assumption.
The distinction matters because the failure mode of using the wrong tool is quiet: it appears to work, slower than you expected, and the resulting image is quietly missing chunks of the file you actually cared about. I want to walk through what each tool is actually doing, when to reach for which, and the parts of a real rescue that the one-liners everyone pastes into forums leave out.
What dd is actually doing
dd is a block copier. It reads a fixed-size chunk from the input, writes it to the output, and repeats until the input is exhausted. That’s the entire program — no error recovery philosophy beyond “read failed, do what you’re told.” By default what you’re told is: stop.

| |
if/of are input and output — always double, triple check these, because dd will cheerfully destroy a source disk if you swap them. bs=4M sets the block size; the historical 512-byte default is needlessly slow on modern drives, and something in the megabyte range gets you close to the underlying hardware’s real throughput. conv=fsync makes dd flush to physical media before it reports success, rather than declaring victory the moment the write lands in the page cache — without it you can watch the progress bar hit 100% and then wait another few minutes for the actual flush while the kernel finishes writing dirty pages, and if you unplug the drive during that window you’ll clone a slightly corrupted disk and not know it.
For imaging a disk to a file rather than another disk, the syntax is identical with the output pointed at a regular file:
| |
This produces a byte-for-byte image including the partition table, so restoring it is the same command reversed. It also produces a file the exact size of the source disk regardless of how much data is actually on it, which is fine for a 32 GB boot drive and a genuinely bad idea for a mostly-empty 8 TB array — dd has no concept of “this is unallocated space, skip it.” If you need that, partclone or a filesystem-aware tool is the better fit; dd only knows blocks.
Where dd falls over
The moment dd hits a sector the disk can’t read, the default behaviour is to stop the whole copy. Depending on version and options you might get a conv=noerror,sync flag combination that skips the bad sector and pads the output with zeros to keep everything aligned — which sounds like a rescue feature, and technically prevents a hard stop, but it’s a blunt instrument. It doesn’t retry with different read strategies, it doesn’t slow down around damaged regions to coax more data out, and it treats every unreadable sector identically whether it’s one flipped bit or the start of a dead sector cluster. On a disk with scattered bad sectors — the normal failure pattern for a drive that’s dying rather than dead — dd with noerror,sync will get you a image, but it’ll have holes you can’t see without checksumming every file afterward.
This is the actual reason ddrescue exists, and it’s worth understanding before you’re standing in front of a failing disk deciding which tool to trust with the only chance you’ll get.
What ddrescue does differently
ddrescue treats a disk read as a probabilistic thing rather than a binary success or failure. Its core loop: read in large blocks from the areas that respond quickly, skip anything that stalls or errors, keep going forward to capture as much easy data as possible while the disk is behaving, and only afterward go back and work the skipped regions with progressively smaller block sizes and more retries. The reasoning is that a failing disk’s condition can change minute to minute — heat, vibration, a head that’s marginal — so grabbing the cheap 95% first means you don’t lose it while burning time and read-cycles on a sector that was never going to yield anyway.
| |
The two-pass structure is the whole technique. The first pass (-n, no scraping) does the fast sweep — grab everything that reads cleanly, skip anything that doesn’t, don’t waste time retrying yet. The second pass (-r3, retry three times) goes back with the mapfile and works only the regions that failed the first time, retrying each a bounded number of times rather than hammering forever. The mapfile is the part people skip and shouldn’t: it’s a plain-text record of exactly which sectors succeeded, failed, or are still untried, and it means you can stop the rescue, reboot, swap USB enclosures, and resume exactly where you left off instead of starting over. On a disk that’s actively degrading, being able to pause and let it cool down between sessions has saved rescues that a continuous read would have killed outright.
The part everyone skips: don’t work on the only copy
The single biggest mistake in a real disk rescue is rescuing onto a target with less free space than the source, or rescuing in place instead of onto an image. Always image to a file on a separate, healthy disk, never disk-to-disk when the source is failing — if the rescue stalls partway you want a partial image you can keep working, not a partially-overwritten destination disk you’ve now also damaged. And never mount or run filesystem checks against the failing source disk directly; every read you don’t need to make is a read you’re spending against a limited budget of good sectors. Image first, do everything else against the image.
| |
losetup -fP maps the image file as a loop device and probes its partition table (-P), giving you /dev/loop0p1-style device nodes you can mount, fsck, or extract files from — all against the image, with the physically failing disk safely disconnected. If the rescue left holes, ddrescueview (a separate GUI package) renders the mapfile as a coloured bitmap so you can see at a glance whether the damage clustered in one partition or scattered evenly — useful for deciding whether it’s worth another rescue pass or time to accept the loss and move to file-level recovery inside the image.
Reading the mapfile
The mapfile format is plain text and worth glancing at even without the GUI tool — a status line per contiguous region, position, size, and a status character (+ for rescued, - for bad, ? for untried, * for trimmed). A large contiguous - block near the start of the disk on a drive with a filesystem laid out normally often lines up with the partition table or an early filesystem structure, which is bad news; a scatter of small - regions throughout usually means individual files affected rather than the whole volume unreadable. Either way, that partial pass beats dd’s all-or-nothing result: with ddrescue you know precisely which bytes you have and which you don’t, instead of a file full of silent zero-padding you have to discover the hard way when something fails to open.
Speed, and why bigger block sizes aren’t always faster
The bs= parameter gets treated like a free performance knob and it isn’t quite that simple. Larger blocks reduce the number of syscalls, which helps up to a point, but past the point where a single read saturates the underlying transfer rate you’re just allocating bigger buffers for no benefit — and on a USB-attached rescue target, an oversized block size can make a single failed read cost you more retried data than a smaller one would. For a healthy dd clone between two SATA or NVMe devices, 4M to 16M block sizes are a reasonable default; going past that rarely helps and occasionally causes drivers to fragment the request anyway. For ddrescue’s first pass, leave the block size alone — its adaptive algorithm already shrinks it automatically once it starts hitting trouble, dropping from large sequential reads down to sector-sized reads only in the regions that need it, which is the entire point of not specifying noerror,sync behaviour by hand.
One thing worth checking before either tool starts: whether the connection itself is the bottleneck. A rescue running at 3 MB/s over a flaky USB-to-SATA bridge can look identical to a genuinely dying disk, and no amount of tool cleverness fixes a bad cable or a bridge chipset that silently drops the connection under load. If a supposedly-failing disk behaves completely differently plugged directly into a SATA port versus through a USB enclosure, that’s diagnostic information, not a fluke — trust the direct connection’s numbers.
Troubleshooting a stalled rescue
The most common problem in a real ddrescue session isn’t an error message, it’s silence — the process appears to hang with no progress and no output. Check dmesg -w in a second terminal while the rescue runs; a disk that’s genuinely failing will often log ATA reset or timeout errors at the kernel level well before ddrescue itself reports anything, and seeing which sector the kernel is stuck on tells you where the drive is struggling even before the mapfile updates. If the kernel resets happen repeatedly on the same LBA range, that region is likely gone for good and no amount of additional retry passes will change the outcome — better to accept the loss, note it in the mapfile, and move on to whatever’s still reachable.
A second common gotcha: forgetting that ddrescue’s retry passes get exponentially less useful. The jump from zero retries to one or two often recovers a meaningful chunk of previously-failed sectors, because a marginal read genuinely does succeed sometimes on a second attempt. Beyond three or four retries the returns drop close to nothing while the wear on an already-failing disk keeps accumulating — every read attempt is itself a mechanical stress on a drive that’s already struggling. Running -r3 once, checking the mapfile’s percentage-rescued figure, and stopping there if it’s plateaued is usually the better trade than looping retries indefinitely hoping for a miracle.
If ddrescue reports “Input file is not open” or refuses to start, it’s almost always a permissions issue rather than a disk fault — the block device needs to be readable by the invoking user, which in practice means running under sudo or adding the user to the disk group, and it needs to not be mounted or in use by anything else at the time. Unmount every partition on the source disk before starting, including anything auto-mounted by a desktop environment’s disk utility the moment the drive was plugged in — a stray writeback from a mounted filesystem during a rescue is exactly the kind of interference you’re trying to avoid.
Verdict
For a healthy disk-to-disk clone — moving to a bigger drive, standing up an identical boot disk — dd is the right tool: simple, predictable, and fast enough that the extra machinery in ddrescue buys you nothing. The moment you’re working with a disk that’s throwing read errors, SMART warnings, or unexplained slowdowns, switch to ddrescue without a second thought; the two-pass, mapfile-driven approach exists specifically for that scenario and does meaningfully better than dd with error-skipping flags bolted on. If you’re at the point of watching SMART attributes tick toward failure, the rescue should already be running, not still being planned — and once the data’s off, get it onto a real array behind software RAID or a checksumming filesystem so you’re not doing this again next year.




