Index of /andrejciho/Linux/Setting up dual-booting without messing up the MBR

Name Last modified Comments Description

Back Parent Directory

Setting up dual-booting without messing up the MBR

Your MBR (Master Boot Record) lives on the first 512 bytes of your hard drive (/dev/hda or /dev/sda). It contains your boot loader and the basic partition information about your primary partitions and some other stuff. Many times, MBR gets damaged by an unfortunate install of a boot loader. So I'm gonna show you how to have a dual-boot (or more-than-dual-boot) without touching your MBR altogether.

1. When asked by your linux installer where to install the boot loader (grub or lilo or some other one) don't go with the default because that's most likely going to install it to your MBR. So, instead of istalling it on your /dev/hda or /dev/sda, install it to your boot partition of your linux. (In many cases this will be the same as your root partition), e.g. /dev/hda2 or /dev/sda5.

2. Once you are booted in your new linux, "create a snapshot" or "image" of your boot record on your boot partition using the following command:
dd if=/dev/hda2 bs=512 count=1 of=$HOME/mybootrecord
3. Now transfer this file (mybootrecord) to the root of your C: drive. You can do this either by copying it to a USB memory key or emailing it to yourself or however else you want to. You can also just reboot to windows and access your linux partition using some utility that will let you do that, such as explore2fs.

4. Now that you are in windows and you have your mybootrecord file on the root of your C: (C:\mybootrecord), you need to edit yout boot.ini (usually C:\boot.ini) and add a line of code that looks something like this:
C:\mybootrecord="Linux"
So your boot.ini would look something like this:
[boot loader]
timeout=5
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows XP"
C:\mybootrecord="Linux"

You're all set and ready to reboot!

Comments (2) to “Setting up dual-booting without messing up the MBR”

  1. What about if I have already installed Ubuntu and haven't done the step 1 during the instalation. Can I do it afterwards and how? I can't boot into Ubuntu because I reinstalled Win XP which overwrote the MBR.

  2. I already found your other post about the grub and the problem is solved! Thanks again!


Leave a Comment
*Required
*Required (Never published)
 

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-Spam Image