Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Restore default bootloader without harming partitions Install
If your bootloader gets changed or corrupted, this fix will restore it without damage to your disk partitions.

This hint may be a bit esoteric, but I thought I was up for a long night of reinstallation pain before stumbling upon this fix. I made the mistake of trying to use an Ubuntu 9.04 boot CD to install Ubuntu to an external (USB) drive on my Mac.

Don't do this, unless you know the following: Regardless of the fact that you chose the external drive upon which to install Ubuntu, you won't be able to boot back into your Mac without changing the bootloader. I ended up with the dreaded question mark folder when I tried to reboot my Mac, and nothing worked to boot into my OS X partition.

Luckily, I have a bootable external drive with OS X on it, and I was able to boot into it by holding down the Option key (the primary partition still did not show up).

I started searching online for the fix, and it seems that Ubuntu changes the Darwin (default) bootloader to Grub on your internal disk, and OS X won't use it (at least not by default). The fixes listed were kludgy, and amounted to either installing another third party bootloader (called "rEFIt") or completely wiping your internal drive and reinstalling OS X (even a standard install won't work).

Anyway, the fix turned out to be easy with Disk Utility (and probably possible from the OS X boot disc). Run Disk Utility and click on your internal hard disk (the disk itself, not the partition under it). Then click on the Partition tab. If you move the triangular slider that adjusts the partition up and then back to where it was, the "Apply" button becomes active (it starts greyed out). You can now click "Apply," and the partition will be left alone, but the bootloader will be recreated.

When I did this, a window popped up that said, "Are you sure you want to partition the disk? Partitioning this disk will change some of the partitions. No partitions will be erased." If you get a message that partitions will be erased, I'd look into it more before going ahead!

I was surprised that this worked, but when I rebooted, the computer booted straight into OS X from the internal drive.
    •    
  • Currently 3.77 / 5
  You rated: 2 / 5 (30 votes cast)
 
[76,923 views]  

Restore default bootloader without harming partitions | 14 comments | Create New Account
Click here to return to the 'Restore default bootloader without harming partitions' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Restore default bootloader without harming partitions
Authored by: Reaper Man on Nov 20, '09 09:19:12AM

Here are some technical details to understand what this hint is talking about.

First, a bootloader was not restored. Mac OS X has no boot loader in the traditional sense. What you are referring to is the boot code in the Master Boot Record of disk.

The first sector of the GUID Partition Table (GPT) disk contains is a Master Boot Record (MBR). Traditionally, the MBR contained a bootloader that would start the system running. Mac OS X does not normally use this bootloader.

Mac OS X normally uses EFI. The EFI bootloader location is stored in various NVRAM variables that indicate what file to load in order to boot the computer. EFI is much more advanced than older boot systems in that it includes the ability to mount and read file systems.

However, the Macintosh also supports Boot Camp. In order to support Boot Camp the Macintosh will boot from the MBR as described above. The boot settings in NVRAM can be set so that the Macintosh will boot using the MBR instead of the normal EFI settings. This is what makes Boot Camp work. (This is an Mac extension that is not a part of EFI.)

The Ubuntu installer changed the bootloader in the MBR and also set the system NVRAM variable to boot from the MBR. This made it so that your main disk would not show up.

Resizing the partition causes Disk Utility to erase the MBR bootloader and return the system to using EFI.

I would have to guess that opening the Startup Disk Preference Pane would have allowed you to switch back to OS X, although the Ubuntu loader still would have been present. You would see that in the Startup Disk Preference Pane as a selection to boot into Windows. :-)

Just some fun technical knowledge to explain what is really happening.



[ Reply to This | # ]
Restore default bootloader without harming partitions
Authored by: cyberdork33 on Nov 20, '09 11:05:16AM

Yep, also rEFIt is not a bootloader, but rather an EFI executable that allows more control over the default Mac EFI functions (and some other useful EFI tools).



[ Reply to This | # ]
Restore default bootloader without harming partitions
Authored by: Typhoon14 on Nov 20, '09 12:17:45PM

Good explanation. This also goes to show why you in general need to be very careful with anything non-Apple that modifies partitions or boot loaders. The way Apple deals with the MBR is actually rather non-standard. Typically, the MBR is not used at all with EFI, a small amount of data being written there only to let non-EFI systems know that the drive is not blank. Apple actually does write a proper Master Boot Record for the purposes of allowing systems that do not support EFI (Windows XP, and all 32-bit versions of Windows Vista/7) to boot natively. So you have a system with both a Master Boot Record, as well as EFI boot info written to NVRAM. Windows and Linux based disk utilities don't expect this setup and results may be different than you would expect.



[ Reply to This | # ]
Restore default bootloader without harming partitions
Authored by: tofergregg on Nov 21, '09 11:01:11AM

Thanks for the interesting information. I did indeed try to reset the startup disk from System Preferences, but it didn't work. Perhaps it was because I had booted from an external drive.



[ Reply to This | # ]
Restore default bootloader without harming partitions
Authored by: huggybearikf on Nov 22, '09 07:14:14PM

So is there someway to manually erase the MBR bootloader and/or return the system to using EFI through a command console of some sort before entering the OS or through the terminal using the OS X boot disc? I am having the same problem as the OP, but I cannot see the primary partition in the disk utility using the boot disc, and I can't use the trick the OP used.



[ Reply to This | # ]
Restore default bootloader without harming partitions
Authored by: Jorgubb on Jun 04, '10 09:42:22PM

Thank you man! You sved my life!!!



[ Reply to This | # ]
Restore default bootloader without harming partitions
Authored by: blacklaser on Aug 30, '11 02:22:59PM

Hello, being very new to this thread, I want to point out the big trouble I have . After installing BOOTCAMP on the 5 gb partition and running everything as described, I cannot boot the Mac or the WIndows . I presume it starting straight in Windows with a black screen and the message with DISK ERROR , PRESS ANY KEY TO RESTART comes up, the chime is there also. If pressing any key nothing happens . Tried a number of times to restart while holding OPTION KEY. Only them I got a light grey screen with a padlock and a box where I supposed to introduce a password . Tried that to insert my usual Mac admin password, is not working . I have inserted as well the original disk OS 10.5 to run the disk utility, it doesn't respond to C or any other command . I have tried T target mode, it doesn't take a target mode or maybe I am doing something wrong . Please help . Thanks guys .



[ Reply to This | # ]
Restore default bootloader without harming partitions
Authored by: huggybearikf on Nov 22, '09 04:37:19PM

I'm having the exact problem as you describe it, but when I go to disk utility, and select the volume, it only shows one disk partition, the one that I tried to boot windows on, and not my original partition, and I can't wiggle the little arrow thing like you described. The partition that shows up is only a fraction of my hard disk memory, but if, instead of "current", I select multiple partitions, then my full memory shows up. How do I reboot back into Mac OS X??



[ Reply to This | # ]
Restore default bootloader without harming partitions
Authored by: koooldawg on Dec 15, '09 10:00:43PM

I just was tinkering with Ubuntu 9.10, trying to install on a USB hard drive. It was successful, but could no longer boot OS X. I found this, but I couldn't change partitions in DiskUtil. Then I remembered that OS X is based off Unix/BSD. Looked up the manuals for fdisk. Used it from command terminal from OS X install DVD.

fdisk -u /dev/disk0

fdisk here is very similar to the DOS fdisk program, just designed for UNIX
the -u tells it to update MBR without modifying partitions
/dev/disk0 is the hard drive. yours may differ, but i doubt it

This fixed my problem.

Long story short, yes you can do it easily from command line, just boot your install DVD. In terminal, type the command listed above.



[ Reply to This | # ]
Restore default bootloader without harming partitions
Authored by: benokef on Feb 27, '10 02:50:12PM

Hi Chris.
Same problem for me, same fix that worked perfectly well. I knew my data were not corrupted but only hidden but I was afraid to get the situation worse by doing some hazardous tries.
I was just about to install Refit (maybe it would have solved the problem as well...) when I found your post.
Thank you all people who take time to write down their experience for others.
Now, I am wondering how to get Ubuntu work on my external drive and MacBook...
Thanks again.
Benoit, France.



[ Reply to This | # ]
Restore default bootloader without harming partitions
Authored by: Herc on Jul 30, '10 03:13:14AM

Thank you very much! This hint saved from reinstalling my MacBook.
I damaged my Bootloader while preparing a Hackint0sh-USB-Stick - this is still working with OS X 10.6.4



[ Reply to This | # ]
Restore default bootloader without harming partitions
Authored by: esilvester on Aug 02, '10 12:44:31AM

Thanks! I did the exact same thing and this hint saved my bacon. Kudos....



[ Reply to This | # ]
Restore default bootloader without harming partitions
Authored by: GTA_doum on Aug 27, '10 07:47:26PM

Hello,
Thanks a million !
This is the only post I found with information that did work and made me able to boot normally, instead of having the "Waiting for root device" message, and seeing the "EFI Boot" drive when pressing Option key on boot.



[ Reply to This | # ]
Restore default bootloader without harming partitions
Authored by: tr1ckst3r on Jun 01, '12 09:43:22AM

None of the above worked.

My HDD is encrypted, would that be an issue?

I tried...

fdisk -u /dev/disk0

...no results.

I also tried...

fdisk -e /dev/disk0
flag 2 (for extended drive)
write
quit
reboot

....no results

Please help, I have a lot of sensitive data, for the most part is back up, but the most recent data isn't and is extremely sensitive.



[ Reply to This | # ]