When dd becomes Disk Disaster aka (d)isk (d)estroyer

Sector11

Disk Distaster Averted

This works if you are not interested in rescuing the files
just making the device useable again.


OH OH!  I was multi-tasking just like the computer doing two things at once, I had dd'd a USB with VSIDO_LiveCD finished that and plugged in my Ext HDD (250GB) and popped in a fresh usb stick hit the up arrow in a terminal for:
sudo dd if=vsido_v1-2_3.7-1_Kernel.iso of=/dev/sdb bs=4M; sync
and blink ... it was done.

??? that was fast ... only to find out I had just dd'd my 250GB backup HDD to a 600+MB VSIDO_LiveCD.

OH CRAP!

What to do what to do what to do... I spent a bit more than a day with Google scouring the net looking to recover the drive:


Google: recover partition after dd -windows



And I am not geek enough to understand some of the answers say except for: "Stop writing to the disk"  DUH - I ain't that dumb but I remember a time when I wish I had read that first (Win 95 days)

I saw where a guy said; "I have another identical drive so I dd'd that over it and I'm testing recovery techniques."  Must be nice to have the equipment - but it got me thinking: I have 2 x 250GB HDD's  My Int and my Ext HDD's are both 250GB ...
hmmmmmmmmmmmmm

The info on the Ext HDD is only rsync copies of my

Int HDD  =|= Ext HDD
/media/5 =|= /M5
/home    =|= /S11-Jan
/home    =|= /S11-Feb


And these (not copies):

=|= /Wallpapers - my 3000 wallpapers - no loss I kept my best 900, and the net has the rest - someplace. I'm  8) with that.
=|= /MarkBuck --> all his python apps (I can get those again at ConkyCompanions PPA) no loss.


NOTE: First time my backup bash file is used in a month it creates a new month and after a few months I delete all the old ones except for the previous month.

My Int HDD:
Disk /dev/sda: 30401 cylinders, 255 heads, 63 sectors/track
Warning: extended partition does not start at a cylinder boundary.
DOS and Linux will interpret the contents differently.
Units = sectors of 512 bytes, counting from 0

Device Boot       Start       End   #sectors  Id  System
/dev/sda1          2048  31457279   31455232  83  Linux
/dev/sda2      31457280  62910463   31453184  83  Linux
/dev/sda3      62910464  71299071    8388608  82  Linux swap
/dev/sda4      71299072 488396799  417097728   5  Extended
/dev/sda5      71301120 423622655  352321536  83  Linux
/dev/sda6     423624704 456009727   32385024  83  Linux
/dev/sda7     456011776 488396799   32385024  83  Linux


Since my Ext HDD is now a paperweight as everything I read says if I try to "recover" stuff (not really interested in this) I'll NOT get back the first 600+MB that VSIDO is using I was thinking this: How To Do Eveything With DD

This part in particular:

QuoteCloning an entire hard disk:

dd if=/dev/sda of=/dev/sdb conv=notrunc,noerror

In this example, sda is the source. sdb is the target. Do not reverse
the intended source and target. Surprisingly many people do. notrunc
means to not truncate. noerror means to keep going if there is an
error. Normally dd stops at any error, if you have a question about a
hard drive on whether or not it works, you can try to use it as the
source drive for the dd command. You should get an error if it is not
working. target drives need to be really messed up to give an error in
dd.

That should put the seven partitions on my Ext HDD and then I can go in with gparted and delete all the partitions and reformat the HDD as one partition with ext4 and start over with a new backup.

In theory that works, but it took four hours (slow computer) for me to understand that while that was the right thing to do ... there was still more hair pulling coming.

sector11 @ sector11
28 Feb 13 | 20:45:19 ~
         $ sudo dd if=/dev/sda of=/dev/sdb conv=notrunc,noerror
[sudo] password for sector11:
dd: writing to '/dev/sdb': Input/output error
149400129+0 records in
149400128+0 records out
76492865536 bytes (76 GB) copied, 15352.9 s, 5.0 MB/s
sector11 @ sector11
01 Mar 13 | 01:01:29 ~
         $


76GB?  Oops!

But it looked good the 7 partitions were there, except for the final 2 partitions (VSIDO test / and /home (with fluxbox))  the final partition had errors and I could not dismount the first  partition.

Booted with VSIDO USB and ran gparted to delete all partitions and last night after deleting: sdb7, sdb6, sdb5, sdb4, sdb3 & sdb2 I was stuck with that {mumbling} sdb1 that was root and was always "... in use by another file system"

Now what?  Hellooooooooooo Google ... and found:



sudo mkfs.ext3 -m 1 /dev/sdb1


That ^ got rid of the / partition.
I killed that sucker!  RIP!  Well OK mkfs.ext3 -m /dev/sdb1 did for me, but I got to push the button!

gparted then deleted sdb1 and formatted the whole thing as ext4!

DEVICE
/dev/sdb1 removable mounted
on /media/disk type ext4 (rw,nosuid,nodev,noexec,noatime,data=ordered)

USAGE
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/sdb1      ext4  230G  188M  218G   1% /media/disk

FSTAB
( not found )

INFO
UUID=abb17351-0de9-45a1-a910-78398f2730c6


Look at the "Ext" HDD - fully recovered HDD ... starting fresh backups.






  <--- before  dd  after ---> 
Stay Home