-   Slackware (
-   -   Help I killed partition (

mr_mandrill 07-26-2009 06:16 PM

Help I killed partition
I really hope someone can help me.

I was trying to make a usb stick for booting slack installation from my Ubuntu system. I used the following command

dd if=usbboot.img of=/dev/sda bs=512

I wasn't entirly awake when I did this and entered the wrong device name ie a near full 200GB disk of media/wine/backups.

I'm looking into testdisk/photorec as potential solutions, but testdisk doesn't seem to find previous partition and photorec loses any filenames / structures. Is there anything I can do to recover some or all this data retaining some structure / filenames.

P.S. I have a 200gb disk to hand to recover to.

Bruce Hill 07-26-2009 06:43 PM

Maybe try working with ddrescue from Alien Bob's repo.

Check out Linux LEO and download The Beginner's Guide for usage tips.

syg00 07-26-2009 06:52 PM

I doubt ddrescue or its ilk will help - they're for recovery from read errors.
Testdisk is the usually recommended tool, but relies on being able to find "hints" for the start and end of partitions. You just stomped on the start of the disk - for some unknown count of sectors. That wipes out all the metadata for the filesystem as well - not much chance of retrieving filenames unless they are embedded in the file itself I'd reckon.

Edit: Seems like just one partition on the disk - if so you can just use fdisk to create one to cover the entire disk. Doesn't matter that it may be bigger than the filesystem - so long as there was only one previously. Doesn't help recover the data though ...

the3dfxdude 07-26-2009 09:10 PM

If you are really serious about trying to recover the partition beyond just recreating the partition, then I would make a mirror backup of the entire drive first before doing anything to it.

The second thing I would definitely try doing would be to recreate the partition with the original parameters. If you are really lucky, I would guess you might at worst just need a fsck (if some data was actually lost). But it is totally possible you damaged part of the file structure to make it normally unreadable, and then in that case you probably might want to look for some forensic utility that might know the filesystem and how to regenerate the missing parts. (could mkfs do this?) Perhaps you could also find a program to read the fragments of the filesystem that is still intact, and I suppose you are currently thinking that.

It might take trial and error to figure all this out, so that is I suggest a backup before anything, because you could actually make the problem worse.

cartoon 07-27-2009 12:03 AM

I think your disk's partition-table is likely been destroyed, and I have met similar case. you can recover it by testdisk. However it's a good idea to read a guide of testdisk before you move on.
Here are some references

The last link is wonderful, however it is a Chinese site. I'm sorry for it and my poor English.

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