Jump to content

Repairing MBR


Malketh
 Share

6 posts in this topic

Recommended Posts

Well I did an amazingly stupid thing today which involved reinstalling Windows on my dual booting FrankenMac. This of course nuked the MBR which in turn took out the Darwin bootloader. Now to normally fix this I guess you would use your install CD to boot your OSx86 partition and use the Startup Disk preferance pane to fix it.

 

But what if, like a noticable amount of other people here, your Startup Disk pref pane crashes??? What do you do then? I asked myself this for quite a while and while fiddling with things the unix way I discovered this after booting into my installation of 10.4.5:

 

fdisk -u /dev/rdisk0

 

Now what this does it it rebuilds the MBR while leaving your partitions intact, which includes putting the bootloader back. :)

 

Hope this helps others cause I know I spent HOURS today searching the web and these forums whilst poking and prodding my poor Mac to get it booting on its own again.

Link to comment
Share on other sites

Thanks Malketh - I know that I've messed up my MBR a few times and this will be very handy for those who corrupt theirs by installing Windows XP or OS X.

 

Would you mind to write out the specific instructions for the steps you took? Thanks!

Link to comment
Share on other sites

Of course.

 

Start out by putting your installation disc in and booting the machine. When it gives you the boot prompt for the installation disc hit F8 and type in

rd=diskXsY

where X is your hard drive number which starts at 0, and Y is the partition number of your OSx86 installation which starts at 1 (i.e. mine was disk0s1). Once you boot into the OS bring up a termainal and

sudo su -

and type in your password, this puts you into the root (also known as superuser) account. Once you're in superuser mode type

fdisk -u /dev/rdisk0

which if you look at the help options for fdisk you'll see that this command rebuilds the MBR while leaving the partition info intact. the

-u

is VERY IMPORTANT. Once the MBR is rebuilt, pop your installation disc out and reboot the machine and you'll be greeted with the glorious sight of the darwin bootloader once again. :P

Link to comment
Share on other sites

  • 3 weeks later...
 Share

×
×
  • Create New...