Linux – How to Disk Copy with Unreadable Sectors

dddisk-imagelinuxpartition

I want to clone a whole disk bytewise, something like

dd if=/dev/$SRC of=/dev/$DST bs=65536 count=$count

There are better tools for the job, which understand the file system (Windows) and work faster (I don't care), but they fail because of unreadable sectors on the old source disk.

There's actually a single invalid block I have to skip. So I thought about using dd multiple times like

dd if=/dev/$SRC of=/dev/$DST bs=65536 count=...
dd if=/dev/zero of=/dev/$DST bs=65536 count=... skip=... seek=...
dd if=/dev/$SRC of=/dev/$DST bs=65536 count=... skip=... seek=...

with replacing the broken sector data by zeros. Is this a valid approach? I found this question which confuses me.

Best Answer

Do not reinvent the wheel. Use ddrescue.

GNU ddrescue is a data 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 of read errors.

Do not trust dd conv=sync,noerror, unless you really know how it works.

Related Question