I have 320GB HDD that has bad sectors and disk is failing due to errors on read, reported via smartctl. To save as much data, I wanted to perform dd/ddrescue on this disk.
ddrescue had abysmally slow read speed on default settings (300kB/s) from get-go and had no time to experiment with settings so I went with dd. Lets skip the topic of improving ddrescue speed for now.
I used dd command, copying to SSD having >1TB free space:
dd if=/dev/sda of=recovery.img conv=noerror,sync iflag=fullblock status=progress
The problem is, the longer dd goes, the slower it becomes. It started from 10MB/s, quickly falling to 5MB/s and keeps slowing down. It is understandable that when reading bad block I will get slower speed and read error, but speed does never recover and never goes up, even when there are no errors for many gigabytes. Example output:
36571460608 bytes (37 GB, 34 GiB) copied, 7521 s, 4.9 MB/s
dd: error reading '/dev/sda': Input/output error
71428640+0 records in
71428640+0 records out
36571463680 bytes (37 GB, 34 GiB) copied, 7522.87 s, 4.9 MB/s
[a lot of read errors here]
163873310720 bytes (164 GB, 153 GiB) copied, 55200 s, 3.0 MB/s
dd: error reading '/dev/sda': Input/output error
320065087+1 records in
320065088+0 records out
163873325056 bytes (164 GB, 153 GiB) copied, 55202.2 s, 3.0 MB/s
[a lot of read errors here]
180528095744 bytes (181 GB, 168 GiB) copied, 105746 s, 1.7 MB/s
dd: error reading '/dev/sda': Input/output error
352593785+152 records in
352593937+0 records out
180528095744 bytes (181 GB, 168 GiB) copied, 105748 s, 1.7 MB/s
184232141312 bytes (184 GB, 172 GiB) copied, 115892 s, 1.6 MB/s
184232509952 bytes (184 GB, 172 GiB) copied, 115893 s, 1.6 MB/s
192463561216 bytes (192 GB, 179 GiB) copied, 138368 s, 1.4 MB/s
211374223872 bytes (211 GB, 197 GiB) copied, 190337 s, 1.1 MB/s
dd: error reading '/dev/sda': Input/output error
412840143+153 records in
412840296+0 records out
211374231552 bytes (211 GB, 197 GiB) copied, 190342 s, 1.1 MB/s
211374232064 bytes (211 GB, 197 GiB) copied, 190342 s, 1.1 MB/s
dd: error reading '/dev/sda': Input/output error
412840143+154 records in
412840297+0 records out
211374232064 bytes (211 GB, 197 GiB) copied, 190344 s, 1.1 MB/s
In above example, between 181GB - 211GB there were no read errors so many sectors should be ok, but speed never increased to starting ~10MB/s, it kept dropping. There were also no read errors for 1st 37GB (thus missing output), but here speed decrease is understandable due to cache running out and disk failing.
hdparm uses optimal settings for disk speed. iostat reports disk being utilized 100%:
r/s rkB/s rrqm/s %rrqm r_await rareq-sz Device
89.50 358.0k 0.00 0.0% 11.12 4.0k sda
w/s wkB/s wrqm/s %wrqm w_await wareq-sz Device
0.00 0.0k 0.00 0.0% 0.00 0.0k sda
d/s dkB/s drqm/s %drqm d_await dareq-sz Device
0.00 0.0k 0.00 0.0% 0.00 0.0k sda
f/s f_await aqu-sz %util Device
0.00 0.00 0.99 99.5% sda
My question is, why would something like this be a case? How does it work that drive keeps getting slower and slower read speed over time, even without read errors from bad blocks? Why speed never goes up?
Second part of the question: Is it possible for ddrescue to have better speed than dd for good sectors?