dd and damaged media

Recently I’ve tried creating an image of a disk with a single NTFS partition using dd. While copying, it turned out the disk had bad sectors. After a moment of googling I’ve found a tip to use the conv=noerror,sync switches in order for dd to replace the faulty areas with zeros in the created image. It looked like the disk was copied fine, but my attempt to mount the NTFS partition from the image failed with a message from ntfs-3g to run a chkdsk /r on the problematic partition and reboot twice into Windows which was installed on it. That’s what I did, but even after performing these steps an image created using the same method was useless.

I’ve tried to use the ntfsfix Linux utility, but it also failed to repair the damaged partition image. Then I bumped into a GNU tool called ddrescue (don’t confuse it with dd_rescue – they are two different tools!). This program dynamically sets input block size based on whether or not it encountered an error on previous read. As a result, only data that is really missing is gone (i.e. replaced with zeros) in the image created (with sector-level precision compared to block-level precision when using classic dd). After the first run ddrescue tries to read all faulty blocks again, which is why the copying process is longer than when using dd. Yet, ddrescue managed to create an image which I could mount in Linux without any problems, while dd failed to.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s