Home General Chat
If you need urgent support, call 999 or go to your nearest A&E. To contact our Crisis Messenger (open 24/7) text THEMIX to 85258.
Options

Fixing the partition table

Indrid ColdIndrid Cold Posts: 16,688 Skive's The Limit
I'll cut right to the chase: Out of pure stupidity I overwrote the first 512 bytes on my hard drive, and that erased the partition table. Does anyone know of a way to bring it back? For example, some program to scan the hard drive, find all the partitions and recreate the table. Or at least some way to extract the data, so that I won't have lost everything.
There was a primary NTFS partition, and an extended one containing another NTFS, two ext3 and a swap.

Comments

  • Options
    Teh_GerbilTeh_Gerbil Posts: 13,332 Born on Earth, Raised by The Mix
    I really dont know - maybe partition magic, or ghost it over? Not alot i know, sorry :(
  • Options
    Former MemberFormer Member Posts: 1,876,323 The Mix Honorary Guru
    http://www.cgsecurity.org/index.html?testdisk.html

    If it works for you, do the decent thing and give him a donation. :)
  • Options
    Indrid ColdIndrid Cold Posts: 16,688 Skive's The Limit
    This one doesn't even recognize my hard drive... Thanks anyway. :(
  • Options
    Former MemberFormer Member Posts: 1,876,323 The Mix Honorary Guru
    Not good :(. How did you erase it? Do any other utilities, or even the BIOS, detect the drive correctly?
  • Options
    Former MemberFormer Member Posts: 1,876,323 The Mix Honorary Guru
    With FDISK you could try FDISK /MBR to rewrite the master boot record, though I'm not sure how the older versions of FDISK intergrate with NTFS.

    Otherwise your best bet is probably to use Fixmbr from the recovery console that you can get by booting on to your windows cd.
  • Options
    Indrid ColdIndrid Cold Posts: 16,688 Skive's The Limit
    Not good :(. How did you erase it? Do any other utilities, or even the BIOS, detect the drive correctly?
    I used dd to copy the first 512 bytes from another hard drive to that one. Pure stupidity.
  • Options
    Indrid ColdIndrid Cold Posts: 16,688 Skive's The Limit
    Mist wrote:
    With FDISK you could try FDISK /MBR to rewrite the master boot record, though I'm not sure how the older versions of FDISK intergrate with NTFS.

    Otherwise your best bet is probably to use Fixmbr from the recovery console that you can get by booting on to your windows cd.
    I tried the windows rescue disk, but since it can't see a windows partition on this hard drive it thinks the other one is primary. Also I'm not sure how much windows would help with the linux partitions, which is where my most important data was.
  • Options
    Former MemberFormer Member Posts: 1,876,323 The Mix Honorary Guru
    I... erm.... I'm at a loss mate. So long as nothing is written to the disk, apart from on the firt 512 bytes, then your data is there, intact, and somewhat useful. If you can figure out the exact sizes of the partitions, and rewrite the start of the drive, then everything will be good again.

    In reality, you're effin' screwed :). I don't want to say it, but my gut says you are... Whilst the first partition will most likely start at cylinder 1, with modern hard drives being so huge you're rather unlikely to work out exactly where the others started and stopped...

    Not a situation I'd like to be in. I'm sorry for you mate, I know how frustrating this kind of thing can be!
  • Options
    Indrid ColdIndrid Cold Posts: 16,688 Skive's The Limit
    :( They told me there has to be some program that can scan the whole of the hard drive and find the partitions, but I can't find any... And I have my head's hair (expression, meaning everything) on that disk!
  • Options
    Former MemberFormer Member Posts: 1,876,323 The Mix Honorary Guru
    Zalbor wrote:
    I tried the windows rescue disk, but since it can't see a windows partition on this hard drive it thinks the other one is primary. Also I'm not sure how much windows would help with the linux partitions, which is where my most important data was.


    it probably wouldn't. You'd need to somehow boot linux from a floppy and then rerun your boot loader.
  • Options
    Former MemberFormer Member Posts: 1,876,323 The Mix Honorary Guru
    I can't think of anything that'll help you, not off the top of my head. Last time I had anything like this, I'd managed to low-level format the first 10 or 20mb of a 4gb drive back in 2000/2001. I hunted, but ended up just wiping it...

    I'm loathed to suggest it, but a DOS bootable floppy with fdisk may be the way to go. You could try an 'fdisk /mbr' command, and cross your fingers - I'm wary, because I don't know how it'll handle NTFS and Linux partitions. But, if you're knackered anyway...

    Actually, I've just surprised myself! All you need to do is restore a backup of the MBR and you should be laughing! fFdisk /mbr *should* work, and if it were my hard drive, I'd give it a go. No promises... but in my mind, it'll restore the backup of the MBR and not touch anything else. If it fails, then it'll have only changed the first 512 bytes of the drive - which are scrap, anyway.

    I think, at least. I'm very, very tired and I've not done anything like this for a while. Now, I have to go out and port/flow a K series cylinder head. I really don't have the strength at the moment :(.

    Good luck! Let us know how it goes - if it doesn't crack it I'll have a read up later tonight and see if I can come up with any worthwhile suggestions...
  • Options
    Indrid ColdIndrid Cold Posts: 16,688 Skive's The Limit
    It's all fixed! The guys (and girls, I guess) at the forum for Ubuntu (which I'm using) told me of a program called "gpart" (guess partitions) and I used it. It found everything and rebuilt the partition table, so all I had to do was reinstall the bootloader and it's all back to normal! :D :yippe:
  • Options
    Former MemberFormer Member Posts: 1,876,323 The Mix Honorary Guru
    Excellent stuff! I'm glad you sussed it :). And I'll bet you'll keep a copy of the overwritten data for.... ooooooh.... several weeks. At which point you're realise how unlikely it is that you'll overwrite it again. And then you'll trash it all over again ;).
  • Options
    Indrid ColdIndrid Cold Posts: 16,688 Skive's The Limit
    Excellent stuff! I'm glad you sussed it :). And I'll bet you'll keep a copy of the overwritten data for.... ooooooh.... several weeks. At which point you're realise how unlikely it is that you'll overwrite it again. And then you'll trash it all over again ;).
    Heh, I hope not. I've learned my lesson. :)

    Now, I have to figure out what to do with my damn keyboard and my computer will be fine...
  • Options
    Former MemberFormer Member Posts: 1,876,323 The Mix Honorary Guru
    Generally, we press the keys in a downward motion. For example, if you wanted to type SARCASM, you'd press S, followed by A, then R, and a C, then another A, then I guess we'll have another S, and finally, the masterpiece! You'll love this!!!

    We press M.

    ;)

    Would you like me to explain how we use mice as well?
  • Options
    Indrid ColdIndrid Cold Posts: 16,688 Skive's The Limit
    Generally, we press the keys in a downward motion. For example, if you wanted to type SARCASM, you'd press S, followed by A, then R, and a C, then another A, then I guess we'll have another S, and finally, the masterpiece! You'll love this!!!
    :p

    That usually works, but when I want to type a word like "RANT." (notice the . at the end) I'd have to do it like this:

    Press R, press A, press N, press N, press N, press N, press N, press N, press T, press ., press ., press ., press. ... You get the idea.

    I'm using my old keyboard, because my wireless one just stopped working... and I just changed its batteries!
  • Options
    Former MemberFormer Member Posts: 1,876,323 The Mix Honorary Guru
    Pop the keycaps off and get the hoover on it! Mine usually gets blocked by bits of rice... Thoroughly disgusting, how much crud accumulates under the keycaps. Worst ones were garages... filthy mechanics get grease, oil, water, snot, crisps, breadcrumbs - you name it, you'll see it between their keys.

    I remember trying to take a shortcut on a field repair once. I took the keyboard to their airline and dumped 100psi down it, hoping to blow the crud out. It worked superbly - all the muck blew over me. And the keys still played up, so I achieved nothing apart from being miles from home, covered in years of scum. Meh... :)
  • Options
    Indrid ColdIndrid Cold Posts: 16,688 Skive's The Limit
    I've cleaned this one, still doesn't work. That's why I got a new one several months ago. But now that one doesn't work at all! I hope it can be fixed, I love that keyboard!
  • Options
    Former MemberFormer Member Posts: 1,876,323 The Mix Honorary Guru
    Keyboards and mice are funny things. They're the only personal physical aspect of a computer... I'd be lost without mine! I've got a nice 5 year old Cherry keyboard - most modern keyboards just don't have the same feel. And I've got a boring MS Scrollwheel mouse - the one moulded to fit on your hand(properly, not like the more recent models). I'm starting to wish I'd grabbed a spare when I bought this one, as the pointer movement can be a little awkward at times, despite cleaning upthe sensors and whatnot :(.
  • Options
    Former MemberFormer Member Posts: 1,876,323 The Mix Honorary Guru
    For future reference check out Hiren's Boot CD on google
  • Options
    Indrid ColdIndrid Cold Posts: 16,688 Skive's The Limit
    For future reference check out Hiren's Boot CD on google
    Will do.

    About my keyboard... I tried it again after fixing the partition problem, and now it works. :confused:

    Maybe it deemed someone who does a stupid thing to his disk like that isn't worth working with. :p
Sign In or Register to comment.