A disk can, and will, develop bad blocks during its lifetime. Usually the disk firmware is good enough in recognizing failing blocks, before they become unrecoverable and remap them, but nothing is perfect and problems happens.
In that case, where you end up with unrecoverable i/o errors, and your OS refuses to cooperate, don’t give up. Here comes ddrescue, well, to the rescue!
ddrescue is a GNU tool, similar to unix dd but better in handling i/o errors. It is multi-platform, but native to Linux. On Windows it’s available via Cygwin.
GNU ddrescue is often confused with dd_rescue, an unrelated and currently unmaintained project with a similar aim.
ddrescue can be used on any block device, including raw disk devices, partitions, or single files. It automatically uses some smart methods of access like direct i/o, different block sizes, reverse advance and repeated retries to maximize the chances of data recovery.
If you got just a few unreadable files (like what happened to me), then run ddrescue just on the damaged files.
# ddrescue -d –R -r 100 /damageddisk/somedir/damagedfile /rescuedir/recoveredfile
-d instructs to use direct I/O
-R retrims the error area on each retry
-r 100 sets the retry limit to 100
In my experience, if it does not succeed in 10 retries, it won’t ever… but you are free to try and hope for miracles 🙂
</tips&tricks>