Copy a disk without copying errors / Copy a failing drive

Prerequisites: two drives, the one with badblocks, and one clean, attached to the same linux machine.

This procedure will help you fetching the data from a failing drive. Some drive have badblocks but data can still be recovered sometimes; to recover the data, you need to copy them from the failing drive to a clean one omitting errors from this source.

Let’s say the failing drive is /dev/sda and the clean one /dev/sdb

1
dd if=/dev/sda of=/dev/sdd conv=notrunc,noerror,sync & pid=$!

If you want to see progress of the dd command (refresh each 10s):

1
while true; do kill -USR1 $pid ; sleep 10 ; done