LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Using dd to copy bad drive - not going well (https://www.linuxquestions.org/questions/linux-general-1/using-dd-to-copy-bad-drive-not-going-well-431028/)

Z038 04-02-2006 02:20 PM

Using dd to copy bad drive - not going well
 
I've got a 160GB drive that has failed suddenly and dramatically with hardware errors. Some utilities report bad superblock, some report read errors... I'm sure the drive is almost completely dead with serious hardware problems, and I'm not really trying to diagnose that. I'm just trying to recover data from the drives by copying them using dd from the failed drive to a new one.

The dd command sort of works, but I can't mount the resulting copied partition.

The grub partition is an ext3 on hdb1.

Code:

root@0[knoppix]# dd if=/dev/hdb1 of=/dev/hda1 bs=4096 conv=notrunc,noerror
dd: reading `/dev/hdb1': Input/output error
0+0 records in
0+0 records out
0 bytes transferred in 5.389830 seconds (0 bytes/sec)
26096+1 records in
26096+1 records out
106892288 bytes transferred in 44.966707 seconds (2377143 bytes/sec)
root@0[knoppix]# mkdir /mnt/hda1
root@0[knoppix]# mount -t ext3 /dev/hda1 /mnt/hda1
mount: wrong fs type, bad option, bad superblock on /dev/hda1,
      missing codepage or other error
      In some cases useful info is found in syslog - try
      dmesg | tail  or so

My Slackware ReiserFS partition is on hdb5. It occupies all but about 32GB of the drive, but it's a long way from full. I think it really has about 25GB of data.

dd started out like this on the copy of the hdb5 partition

Code:

root@0[knoppix]# dd if=/dev/hdb5 of=/dev/hda1 bs=4096 conv=notrunc,noerror
dd: reading `/dev/hdb5': Input/output error
3818+0 records in
3818+0 records out
15638528 bytes transferred in 557.421395 seconds (28055 bytes/sec)
dd: reading `/dev/hdb5': Input/output error
3818+0 records in
3818+0 records out
15638528 bytes transferred in 568.121932 seconds (27527 bytes/sec)
dd: reading `/dev/hdb5': Input/output error
3818+0 records in
3818+0 records out

But it is getting progressively slower - right now it is taking several several times longer per bunch of records than it did at first, and it has a very long way to go on this partition. I'm thinking at this rate it could finish sometime roughly week after next and I probably still won't be able to mount the partition.

Code:

dd: reading `/dev/hdb5': Input/output error
3823+0 records in
3823+0 records out
15659008 bytes transferred in 2883.704467 seconds (5430 bytes/sec)
dd: reading `/dev/hdb5': Input/output error
3823+0 records in
3823+0 records out
15659008 bytes transferred in 2894.346530 seconds (5410 bytes/sec)
dd: reading `/dev/hdb5': Input/output error
3823+0 records in
3823+0 records out
15659008 bytes transferred in 2904.988522 seconds (5390 bytes/sec)
dd: reading `/dev/hdb5': Input/output error
3823+0 records in
3823+0 records out
15659008 bytes transferred in 2915.630540 seconds (5371 bytes/sec)
dd: reading `/dev/hdb5': Input/output error
3823+0 records in
3823+0 records out
15659008 bytes transferred in 2926.272590 seconds (5351 bytes/sec)

Clearly, I need to start backing up my data going forward so I don't have this sort of disaster again. I'll search the board looking for good methods for backing up huge drives. But in the meantime, does anyone have any practical suggestions for possibly recovering the data from my hdb5 drive? I don't care much about the other partitions.

Z038 04-02-2006 04:26 PM

Hmmmmm. The time reported by dd is apparently unrelated to our present space-time continuum. It's not week after next yet, but dd says:

Code:

dd: reading `/dev/hdb5': Input/output error
33323+0 records in
33323+0 records out
136491008 bytes transferred in 5254.954366 seconds (25974 bytes/sec)
dd: reading `/dev/hdb5': Input/output error
688768+0 records in
688768+0 records out
2821193728 bytes transferred in 6818.558848 seconds (413752 bytes/sec)
dd: reading `/dev/hdb5': Input/output error
688772+0 records in
688772+0 records out
2821210112 bytes transferred in 6833.098622 seconds (412874 bytes/sec)

Maybe it'll finish in only a few days... but I bet I still won't be able to mount it.

Whaddayathink?

haertig 04-02-2006 04:39 PM

You might want to look into "ddrescue" and "ddrhelp". "dd" will have slowdowns and possily aborts when it encounters bad spots on the disk. ddrescue will try a couple of times, and finally continue on when it encounters errors. ddrhelp wraps around ddrescue and adds logic that says "when you encounter a bad spot, skip ahead and come bad for the bad spots later". This is good for when your drive is dieing rapidly and you want to recover as much as possible, as quickly as possible, without wasting time on the bad stuff. Do the good stuff first, then come back and make attempts at the bad stuff later.

haertig 04-02-2006 04:44 PM

Quote:

The dd command sort of works, but I can't mount the resulting copied partition.
Did you try running fsck on the copy (the recovered data)? It might be mountable after a little help from fsck to clear up any corruption present.

Z038 04-02-2006 04:46 PM

Thanks, haertig. I'll check it out. One thing about dd is that the disk partitions don't need to be mounted. This is important in this case, since I can't mount these partitions at all. It's funny, because grub half boots, meaning that it loads to stage 2, gets stuck, then comes out with a prompt. None of the command line grub options at that point work.

If dd fails to do the job, I'll definitely try ddrescue and ddrhelp if I find they can operate with the disk unmounted too.

Meanwhile, I'm eating a green salad with smoked tomato dressing and smoking GLP Montgomery in a Rad Davis 2005 ASP club pipe Volcano. Digging Lynyrd Skynryrd on the radio. Can't ask for much more. Life is good.

Z038 04-02-2006 04:51 PM

Quote:

Originally Posted by haertig
Did you try running fsck on the copy (the recovered data)? It might be mountable after a little help from fsck to clear up any corruption present.

Nope. Good idea, thank you. I'll do that when dd finishes with the current copy operation. I'll report back if and when.

haertig 04-02-2006 07:46 PM

These do work on unmounted filesystems.

dd_rescue: http://www.garloff.de/kurt/linux/ddrescue/

dd_rhelp: http://www.kalysto.org/utilities/dd_rhelp/index.en.html

Now I'm off to find my old albums, I always liked Sweet Home Alabama and Free Bird (now that you've reminded me!) I know where the albums are, it's just finding a working turntable... ;)


All times are GMT -5. The time now is 04:09 AM.