Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking to use dd to make a clone of failing harddrive. My concern is there will be bad blocks for surely. So my question is with dd will a bad block leave a gap the size of the selected block-size(bs) or will it only be as big as the sector on the harddrive?

share|improve this question
I don't know, but your hard drive should be getting requests to return bytes or several bytes at a time. I'd expect that dd would gracefully handle whatever the hard drive gives back. So if the drive actually signals that there's a complete failure to read that data (not sure they have a signal for that), then dd should handle that gracefully. Hard drives have brains in them to mitigate damage and deal with bad blocks. That mitigation has limits to it, but it's possible with a failing drive, to use it normally just a little more before it completely morphs in to a paper weight. Good luck. – Doc Jul 11 '11 at 17:12

I'm pretty sure it'll be the larger of the two.

Let's say you're using a 512 byte block-size in dd, but your disk uses 4K sectors, and one of them is bad. All four 512-byte reads that dd tries to make of that 4K sector will fail, resulting in a 4K gap.

Now let's say you're using an 8K dd block-size but your disk uses 4K sectors. When dd attempts to do that 8K read, it will fail because one of the sectors in the read failed, resulting in an 8K gap.

Now is probably a good time to mention GNU ddrescue (not to be confused with the non-GNU software of the same name) which basically automates using dd to rescue a failing drive, with several efficiency tricks. It starts with a large block size for speed, but it keeps track of where it saw bad blocks and then goes back to try to read different parts of them with smaller read sizes, until it gets down to a list of absolutely unreadable 512-byte blocks. It took me a while to make sense of the documentation but once I figured it out, I found it to be a very useful tool and very preferable to using dd directly myself for this kind of task.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .