I have a faulty 320GB drive which has reading errors in samish GB positions but the exact positions vary. I am ok with probability of errors, this is out of question here.
First of all I was surprised with that I need
conv=noerror being actually useful but ok, I have spare time to grow new foot. I found it because of
file -s /dev/sdc* did not give any sensible output for last partitions (i.e. same as for source drive), it said
data instead. However, I did not get any practical improvement after I added
sync to my command line: the
file -s output still makes no sense except for first partition which does not contain errors in FS description section so
file -s command detects FS correctly. I confirm erratic copying with
mount -o ro for both drives and comparing
md5sums for all files (but directory structure alone is erratic).
I am trying to dd it to new bigger drive this way:
dd if=/dev/sda3 conv=noerror,sync bs=1M of=/dev/sdc3 2> /part3_log grep -oPaz '[[:digit:]]*(?=\+[[:digit:]]+ records out\n)' </part3_log >/part3_log_bads # parsing is ok for this specific case rm /part3_log_01 for i in $(cat /part3_log_bads); do dd if=/dev/sda3 conv=noerror,sync bs=1M of=/dev/sdc3 skip=$((i-1)) seek=$((i-1)) count=1 2>>/part3_log_01; done # retrying erratic blocks. i-1 because of number of records is written after erratic block was padded and written. noerror does not make any practical difference here.
I get this output for each erratic block in
/part3_log (as expected):
dd: error reading ‘/dev/sda3’: Input/output error 71051+3 records in <<<<<<<<< second number increments from 0 after each erratic block indicating partial read, this is expected 71054+0 records out 74505519104 bytes (75 GB) copied, 2546,96 s, 29,3 MB/s
And I get this strange output (speed difference is expected) for all blocks in
1048576 bytes (1,0 MB) copied, 6,5663 s, 160 kB/s 0+1 records in 0+0 records out 0 bytes (0 B) copied, 6,41877 s, 0,0 kB/s 0+1 records in 1+0 records out 1048576 bytes (1,0 MB) copied, 7,42028 s, 141 kB/s 1+0 records in 1+0 records out
What draws my attention is that almost each input record is read partially while there are no errors reported despite them actually happening (I see them in
dmesg). There are no error being reported for
sdc (as expected, it's a new drive).
So, ho do I blindly copy faulty drive and then retry the faulty records? My approach seems to fail at two points:
- it fails to copy data without shift occuring after erratic blocks (despite
- it fails to report errors while retrying bad blocks.
P.S. I would like to do it with
dd only. Using
ddrescue is problematic ATM.
P.P.S. It's Debian 8.7.1 and dd 8.23