So the IT people told me my harddrive on my macbookpro was dead, I assured them, that the hardrive was fine, and the real problem was that the motherboard had died. However, somewhere in the process I of trying to recover osx I managed to corrupt the partition table.

I tried a variety of tricks to recover the machine including: testdisk (do a google search you’ll find it right away), the OSX Installer Disk (both 10.4 and 10.5), and using the block numbers from testdisk to rewrite the partition table (testdisk won’t write HFS+ / MAC partitians for you).

Finally after fooling around with testdisk and fdisk after mounting the drive in my ubuntu box, I fired up gparted. Gparted could see my partitions just fine, but warned me that something weird was going on.

Somewhere in this process I tried to mount my drive using:

mount -t hfsplus /dev/sda1 /mnt/other

I got a bad superblock, which lead me to believe that I either needed to fsck — (a really bad idea if my partition boundaries were wrong) — or my partition boundaries were wrong, and all I had to do was find the right boundaries).

So I launched parted the command line program that gparted wraps. parted could see my partitions, but fdisk couldn’t. After much fooling around I deleted my partition table using parted (hey it wasn’t working anyway), and then used the parted, rescue command with the partition boundaries that were printed in parted when I typed “print”, but not mountable. In my case I typed

rescue 120M [some big block number]

.

Parted ran for a little bit, found my partition, and mounted it — no problem!

Success!

Key things to remember:
1) Don’t Reformat
2) Don’t run repair disk or check disk, or anything that might mess up your data
3) Every time something gives you a partition boundary (OSX / fdisk / pdisk / testdisk / disk utility) –> WRITE IT DOWN
4) I am pretty sure I burned the EFI partition at the beginning of the disk somewhere in this process, so for me it was essential to have an ubuntu computer to put my drive in, with enough disk space to back everything up. [luckily EFI takes up 120M or so at the beginning of the disk, so overwriting bits and pieces of it here and there weren’t a big deal, if all I was looking for was my main osx partition.

Advertisements