PDA

View Full Version : xom.efi creates MBR / MBR overrised GPT on MacOSX


jerbare
16th March 2006, 10:13 PM
[edit - title is supposed to be OVERRIDES, heh...]

I was beginning to start working on a solution for attempting to boot Windows XP off of an external disk instead of burning discs. I dumped a copy of the xom.efi file on my the external to play with, loaded up the EFI console and selected it to boot from. I saw some nice debug output from it and it froze due to no floppy.img being present...

No worries, so I boot back in to Mac OS X.

Woops, there go all of my extra partitions! I had 4 regular partitions (5 counting the EFI partition). Looks like xom.efi writes an MBR to the internal disk, regardless of where you boot it from... The problem is that there are more than the 4 primary partitions that an FDISK partition scheme can handle... Understandable...

So I go to Disk Utility. It only saw the main Mac OS X partition. I open up a console and check out the status of gpt:

sudo gpt -r show /dev/disk0

Good deal. With GPT you dont have much to worry about, because it actually has a primary and a secondary backup of the partition table - one at the beginning and one at the end.

So I figure I'll boot off of the Installer DVD, ensure thats the case and zero out the first 512 bytes on the hard drive. They shouldn't mean squat from the GUID Partition Scheme according to the spec. If the first 512 bytes of the disk are empty, I figured Mac OS X would check for the GPT, and recognize the disk... So I pop open a terminal and decide to zero out the first 512 bytes...

dd if=/dev/zero of=/dev/rdisk0 bs=512 count=1

Sure enough, as SOON as I hit enter I think 'Hmm... I should have probably wrote a backup of that to the Firewire disk...'

Quit the terminal, open Disk Utility. No partitions - the disk is empty.

Okay, figure it will take a reboot for the kernel to reinitialize the disk and scan for the GPT in either location...

WRONG.

It appears Apple is writing SOMETHING to the first 512 bytes of the disk in order to flag Mac OS X that the disk is GPT. Sure enough I have some data fairly useful data on the disk I would VERY MUCH like to NOT LOSE. Heh... Silly me...

I checked the status of gpt again after all of this, and it VERY MUCH appears to show the partition tables intact. The disk looks fine. However, Disk Utility nor /dev show any partitions for disk0.

Can somebody who hasn't run xom.efi on their intel Mac do me a BIG favor and hook me up with the first 512 bytes of their HD? It should be pretty simple, and I'm not sure if you'll be able to write to the same HD - but an external or USB jump drive should work.

This is a 20" iMac Core Duo with the 250gb - but I'm willing to try anything...

Just boot off of the Install Disk and open up Terminal from the menu. Run this after finding a place to write to:
dd if=/dev/rdisk0 of=/Volumes/SOMETHING/help.bin bs=512 count=1

This is going to read the first 512 bytes off the GPT disk and write them to a file called help.bin. If you can then hook me up with this I would greatly appreciate it.

jerbare
16th March 2006, 10:42 PM
Can somebody who hasn't run xom.efi on their intel Mac do me a BIG favor and hook me up with the first 512 bytes of their HD? It should be pretty simple, and I'm not sure if you'll be able to write to the same HD - but an external or USB jump drive should work.

Shortly after my brief "panic attack" and posting, I realized "Hey, I have a jump drive... I'll repartition it as GPT and do this myself"...

Sure enough, that seemed to work. So never mind... I can see the most important partitions, but I dont know if some of the other minor FAT32 ones will recover...

Anyhow, let this be a warning: be careful using xom.efi if you value your data!

I'm very interested in triple booting, so with a legacy MBR I'll be limited to 3 usable partitions (the fourth is the EFI partition at disk0s1)...

maconic
17th March 2006, 01:05 PM
Hi,

I was doing the same stuff, started xom.efi from external usb, it crashed. Result is: I am now unable to boot from the internal HD, but rEFIt helps.
I can see all my partition though :)

Question is: how can I make my internal HD bootable again? (Disk utility does not help)


BR;
MaC

SpecMode
17th March 2006, 01:07 PM
Try booting from the Mac OS X installer CD; when the menu bar loads, open up Terminal. Use the following commands:

cd /Volumes/yourproblemdisk/System/Library/CoreServices

sudo bless --folder . --file boot.efi --setBoot

Obviously, replace 'yourproblemdisk' with the actual name of your internal drive. This re-enables the 'official' Apple bootloader, so you should hopefully be able to get back into OS X.

maconic
17th March 2006, 01:17 PM
Hi!

Thanks for your hint, but it does not seem to be the problem.
If I hold down the alt key and select the OSX Volume to boot, then
it just normaly boots.

So its not about the blessing :(

If I bless xom.efi then it also works, I get the selection menu, but I have to hold down alt and choose the internal hdd.

This is something about xom.efi did to my harddisk.
Maybe the added MBR?
Dunno :(

BR;
MaC

SpecMode
17th March 2006, 01:23 PM
Hrm...so, have you had the USB drive connected the whole time? If so, does this behavior continue after disconnecting it?

Also, have you tried manually resetting your startup volume in System Preferences once you've gotten into OS X?

(shots in the dark, but one might end up hitting the mark eventually :))

maconic
17th March 2006, 01:24 PM
I had these ideas myself :)

Its not about the USB drive, I have just connected it to be able to boot at all.
Also resetting using the startup disk tool does not help :(

It is what xom.efi changed on the hdd :(

I just wonder why this does not happen to ppl who completed the installation of xp. I just started xom.efi from the flash drive, but did not install windows.


BR;
MaC

boohoo
17th March 2006, 03:55 PM
I also cannot boot off my internal hard disk now :( help...

boohoo
17th March 2006, 04:10 PM
correction install to the hard disk. cant boot from it either cos there is no os on either partition after i reformatted it :(

maconic
17th March 2006, 04:43 PM
Well I guess it would solve the problem if one writes back a gpt "pmbr" instead of the mbr created by xos.efi.

I just can't try this, as I hav no install dvd with me know :(

You can use a USB pendrive or any drive to create a gpt based partition table (disk utility can do this), then just dd from the one drive to another.
Yet you can't do this if the drive is mounted, this is why you need the install DVD.


BR;
MaC

boohoo
17th March 2006, 04:52 PM
After about 30 mins of crapping my pants, repartitioning and generally feeling a bit gutted I used the Erase option in disk utility and selected the option to zero the internal hard disk. After this and reparitioning i can now reinstall and boot from the internal hard disk. Maybe this will work for you too :)

maconic
17th March 2006, 05:08 PM
Wohuu, we seem to be talking about different things.

I did NOT wipe anything out, all my partitions are still there.
Its just that OS X does not boot, without holding down the alt key and selecting the hdd.

Sry for you data :(


BR;
MaC

boohoo
17th March 2006, 05:21 PM
I backed up before I started :D

jerbare
17th March 2006, 06:12 PM
I just wrote up an extensive how-to thread located here:
http://forum.onmac.net/showthread.php?t=136
"Recovering your GUID Partition Table (restoring the PMBR)"

Please wait for someone experienced to verify my steps before attempting them yourself.

maconic
20th March 2006, 12:17 PM
Thanks!


Just posted you a reply there!


BR;
MaC

mcnaugha
20th March 2006, 03:27 PM
I backed up before I started :D

If you don't need to keep any of the data, you can return your Intel Mac's hard drive to "square one" by using the command line tool 'diskutil'.

It seems that at least in current releases of the GUI Disk Utility they forgot to make it fool proof at returning the disk to a GPT state.

Here is an example usage (where the HD is 250GB):

When booted from DVD, access the Terminal from the Utilities menu and enter the following:

diskutil partitionDisk disk0 2 GPTFormat "MS-DOS FAT32" XP 125G "Journaled HFS+" "Macintosh HD" 125G

This takes you back to the stage where you have your two partitions, one for Mac OS X and one for Windows XP. The Mac OS X Installer will now recognise your partition as bootable.

To restore your Mac to the out-of-box single partition state (again for 250GB HDD):

diskutil partitionDisk disk0 1 GPTFormat "Journaled HFS+" "Macintosh HD" 250G

Entering just "diskutil partitionDisk" will show you the full usage instructions.

kzt
20th March 2006, 03:44 PM
It seems that at least in current releases of the GUI Disk Utility they forgot to make it fool proof at returning the disk to a GPT state.
Not entirely true. If you are not worried about losing data (you will), then do the following:

In Disk Utility:
Select the whole disk (not just a partition).
Select the erase tab. Keep the defaults, select erase.
Then you can go into the partition tab and set up for another try (if you want).

I've had to do this about a hundred times trying to get a friend's MBP to work, so I can verify that it does work.

mcnaugha
20th March 2006, 04:01 PM
Not entirely true. If you are not worried about losing data (you will), then do the following:

In Disk Utility:
Select the whole disk (not just a partition).
Select the erase tab. Keep the defaults, select erase.
Then you can go into the partition tab and set up for another try (if you want).

I've had to do this about a hundred times trying to get a friend's MBP to work, so I can verify that it does work.

I did say "seems".

On the systems I'm using this on Disk Utility doesn't restore the GPT. I have tried repartitioning with the GUI several times and it still does not restore the drive to be bootable (i.e. GPT). Can you confirm you can then get the Intel Mac OS X Installer to recognise the partitions as bootable in the Volume Selection dialog? On my iMac 20" and MacBook Pro it is prep'ing the partitions in ye olde MBR.

mcnaugha
20th March 2006, 04:20 PM
There's supposed to be an "Options" button and then a partition scheme pop-up menu where you need to choose "GUID Partition Scheme". I don't see this.

This is discussed in Knowledge Base article: 303220
http://docs.info.apple.com/article.html?artnum=303220

The command line is guaranteed to work if you put the right syntax.