Any Linux tools/tricks for recovering dying drive?

Red Squirrel

No Lifer
May 24, 2003
69,818
13,392
126
www.anyf.ca
I'm trying to see if I can see the data on a drive that id dying, it's a laptop drive and I just get tons of I/O errors when I try to mount or do anything to it. At one point I was able to see files.

Here's an example of stuff showing up in dmesg:

Code:
[12279.508905] sd 23:0:0:0: [sdc] Unhandled sense code
[12279.508912] sd 23:0:0:0: [sdc]  
[12279.508915] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[12279.508918] sd 23:0:0:0: [sdc]  
[12279.508920] Sense Key : Medium Error [current] 
[12279.508926] sd 23:0:0:0: [sdc]  
[12279.508929] Add. Sense: Unrecovered read error
[12279.508933] sd 23:0:0:0: [sdc] CDB: 
[12279.508935] Read(10): 28 00 03 e9 73 da 00 00 06 00
[12279.508947] end_request: critical target error, dev sdc, sector 65631194
[12279.508952] quiet_error: 232 callbacks suppressed
[12279.508956] Buffer I/O error on device sdc3, logical block 34704346
[12279.508961] Buffer I/O error on device sdc3, logical block 34704347
[12279.508964] Buffer I/O error on device sdc3, logical block 34704348
[12279.508967] Buffer I/O error on device sdc3, logical block 34704349
[12279.508969] Buffer I/O error on device sdc3, logical block 34704350
[12279.508972] Buffer I/O error on device sdc3, logical block 34704351
[12282.015229] sd 23:0:0:0: [sdc] Unhandled sense code
[12282.015237] sd 23:0:0:0: [sdc]  
[12282.015240] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[12282.015243] sd 23:0:0:0: [sdc]  
[12282.015246] Sense Key : Medium Error [current] 
[12282.015251] sd 23:0:0:0: [sdc]  
[12282.015254] Add. Sense: Unrecovered read error
[12282.015258] sd 23:0:0:0: [sdc] CDB: 
[12282.015259] Read(10): 28 00 03 e9 73 da 00 00 01 00
[12282.015272] end_request: critical target error, dev sdc, sector 65631194
[12282.015278] Buffer I/O error on device sdc3, logical block 34704346
[12286.541759] sd 23:0:0:0: [sdc] Unhandled sense code
[12286.541766] sd 23:0:0:0: [sdc]  
[12286.541770] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[12286.541773] sd 23:0:0:0: [sdc]  
[12286.541775] Sense Key : Medium Error [current] 
[12286.541781] sd 23:0:0:0: [sdc]  
[12286.541784] Add. Sense: Unrecovered read error
[12286.541788] sd 23:0:0:0: [sdc] CDB: 
[12286.541790] Read(10): 28 00 03 e9 73 db 00 00 01 00
[12286.541802] end_request: critical target error, dev sdc, sector 65631195
[12286.541808] Buffer I/O error on device sdc3, logical block 34704347
[12290.224875] sd 23:0:0:0: [sdc] Unhandled sense code
[12290.224882] sd 23:0:0:0: [sdc]  
[12290.224885] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[12290.224889] sd 23:0:0:0: [sdc]  
[12290.224891] Sense Key : Medium Error [current] 
[12290.224897] sd 23:0:0:0: [sdc]  
[12290.224900] Add. Sense: Unrecovered read error
[12290.224904] sd 23:0:0:0: [sdc] CDB: 
[12290.224905] Read(10): 28 00 03 e9 73 da 00 00 01 00
[12290.224918] end_request: critical target error, dev sdc, sector 65631194
[12290.224924] Buffer I/O error on device sdc3, logical block 34704346
[12296.393697] sd 23:0:0:0: [sdc] Unhandled sense code
[12296.393700] sd 23:0:0:0: [sdc]  
[12296.393702] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[12296.393704] sd 23:0:0:0: [sdc]  
[12296.393705] Sense Key : Medium Error [current] 
[12296.393707] sd 23:0:0:0: [sdc]  
[12296.393709] Add. Sense: Unrecovered read error
[12296.393711] sd 23:0:0:0: [sdc] CDB: 
[12296.393712] Read(10): 28 00 03 e9 73 db 00 00 01 00
[12296.393718] end_request: critical target error, dev sdc, sector 65631195
[12296.393722] Buffer I/O error on device sdc3, logical block 34704347
[12367.281519] sd 23:0:0:0: Device offlined - not ready after error recovery
[12367.281533] sd 23:0:0:0: [sdc] Unhandled error code
[12367.281537] sd 23:0:0:0: [sdc]  
[12367.281540] Result: hostbyte=DID_ABORT driverbyte=DRIVER_OK
[12367.281543] sd 23:0:0:0: [sdc] CDB: 
[12367.281546] Read(10): 28 00 00 00 00 00 00 00 20 00
[12367.281559] end_request: I/O error, dev sdc, sector 0
[12367.281564] Buffer I/O error on device sdc, logical block 0
[12367.281576] Buffer I/O error on device sdc, logical block 1
[12367.281579] Buffer I/O error on device sdc, logical block 2
[12367.281582] Buffer I/O error on device sdc, logical block 3
[12367.281638] sd 23:0:0:0: rejecting I/O to offline device
[12367.281646] usb 1-1.4: USB disconnect, device number 16
[12367.484233] usb 1-1.4: new high-speed USB device number 17 using ehci-pci
[12367.577441] usb 1-1.4: New USB device found, idVendor=152d, idProduct=2338
[12367.577444] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=5
[12367.577445] usb 1-1.4: Product: USB to ATA/ATAPI bridge
[12367.577446] usb 1-1.4: Manufacturer: JMicron
[12367.577448] usb 1-1.4: SerialNumber: 000001D91841
[12367.578130] scsi24 : usb-storage 1-1.4:1.0
[12389.329641] usb 1-1.4: reset high-speed USB device number 17 using ehci-pci
[12399.482910] usb 1-1.4: reset high-speed USB device number 17 using ehci-pci


I'm just wondering if there's anything I can try, or if this drive is pretty much pooched. I did try the freezer trick, I put it in there for about 2 hours.

It's not mine, I know better and use raid and backups but I'm just trying to do someone a favor. Thankfully trying to get data off a dying drive is not something I need to do often so maybe there's some tools or tricks I'm missing. :p

The drive does spin up, I can also hear it click sometimes, that's usually when I lose it completely.
 

Soulkeeper

Diamond Member
Nov 23, 2001
6,731
155
106
The last drive from someone who had a similar issue, I was able to mount and cp around 85% of the files off.
cp will keep going even with the errors, then afterwards you can analyse them and see what you were able to get.
cp on a laptop drive with some kinda head/seek issues took many hours last time I tried.

That's pretty much all you can do besides having professional recovery/cleanroom work done on the drive.
 

Red Squirrel

No Lifer
May 24, 2003
69,818
13,392
126
www.anyf.ca
Hmm so if I can't even mount it then I'm pretty much out of luck.

What about dd, is there a way I can dd it and just make it skip errors? I'm not sure how dd works in that respect. The drive also resets so not sure if dd would even work for that since the drive is completely lost till it is cycled again. This makes me think, I wonder if I could make a device using arduino for situations like this. Could become handy. I wont go out of my way for this particular drive though, but would make a fun little project. Basically it would power the drive on/off when it loses it and keep copying where it left off.
 

ethebubbeth

Golden Member
May 2, 2003
1,740
5
91
With failing storage, dd will usually bomb out when it encounters errors.

Instead, use ddrescue. It is a modified version of dd that is meant to keep going through errors in case storage is damaged or failing.

Documentation:
http://www.gnu.org/software/ddrescue/

Please note that it might be listed as ddrescue or gddrescue in repositories depending upon you distro. Also note that dd_rescue is entirely different and not recommended, ddrescue has superseded its usage.
 
Last edited:

Red Squirrel

No Lifer
May 24, 2003
69,818
13,392
126
www.anyf.ca
Neat, trying that tool now, I'll see how it goes. This could be a while. :p Probably should have set it up in my server room, not on my desk lol.

Code:
rescued:   102064 kB,  errsize:   40960 B,  current rate:     567 kB/s
   ipos:   102105 kB,   errors:       1,    average rate:     911 kB/s
   opos:   102105 kB,     time since last successful read:       0 s
Copying non-tried blocks...

At least if I get something though I'll be able to mount it via block device and access it that way.
 
Feb 25, 2011
16,986
1,617
126
I had a drive with bad blocks recently. Cloned it to its replacement with dd and the "conv=noerror,sync" cli arguments.

Worked fine.
 

Red Squirrel

No Lifer
May 24, 2003
69,818
13,392
126
www.anyf.ca
Trying out ddrescue, it seems to be working, though, I did something really stupid. My hard drive enclosure was plugged into the same outlet as the light. you can guess what happened when I turned the light switch off. LOL

I just finished setting it up in my server rack and plugged it into the big UPS. Out of sight out of harms way lol. I had about 4GB done so this is probably going to take weeks. :p

For all I know 50% of those sectors are bad and this is doing absolutely nothing but figure it's worth a try, minimal work once it's setup.
 

Knavish

Senior member
May 17, 2002
910
3
81
Several years ago I used a utility that took the output file (probably from ddrescue) and dug through it byte by byte, automatically trying to recover files. It think it looked for common header bytes in things like JPGs, DOCs, etc...

Do any of you know the name of that utility?
 

Red Squirrel

No Lifer
May 24, 2003
69,818
13,392
126
www.anyf.ca
That would be neat too, I can see myself possibly needing that. Running into tons of errors, but it's still going! About 25GB last I checked. Though if I can get a raw image that is high enough quality so it recognizes partitions and can mount I'll be pretty happy then I can dig through the files or run a recovery tool if the partition table is screwed up beyond repair.

At this point I'm mostly doing it just for fun because I can easily just tell the guy the drive is toast, because I'm pretty sure it is. :p I'll be surprised if I do pull anything. TONS of I/O errors in dmesg lol.