Search This Blog

Friday, October 02, 2009

Dual Boot Windows XP (and below) with Linux using Windows MBR

I just noticed that there are 101 FAQ out there to teach you how to dual boot Windows and Linux using LILO, GRUB etc. Maybe its just me, but nobody is happy with Windows Boot Manager? There is a clean and simple way to enable the booting of Linux without choose LILO or Grub. Its just a simple boot sector file added to the Windows Boot Manager and you have it. Why does everyone has to choose LILO or Grub?

Well, so here I am going to talk about this legacy method. Bear in mind that this does not apply to Windows Vista because of the BCD Boot Manager. That you can find it online.

First, figure out a way to get to your Linux. The best thing will be you just finish installing and has not rebooted. Make sure you had chosen to install the Linux Boot sector on the partition itself (sda1 or hda1 etc...) instead of the harddisk (sda or hda etc...). If you had overwritten the bootsector, do a repair with your Windows CD. Its a painful process and I hope you have not come to this. Alternatively, use Super Grub Disk to restore your Windows MBR. You can also us this to boot back into your Linux if you had installed the bootloader into the partition and rebooted (oopps).

Get back into your Linux. Mount your windows directory. Or USB disc etc.An example will be:

#mkdir /tmp/windows#mount /dev/sda6 /tmp/windows

sda6 is your Linux partition. You can use Super Grub Disk to navigate and found out anyway.Now you will need to extract the bootsector of the Linux using this command as root:

#dd if=/dev/sda2 of=/tmp/windows/linux.bin bs=512 count=1

Thats all there is! Well, not really. Reboot back into your Windows. We still have 1 more line to add. Open your boot.ini on your boot drive. You may need to unhide and un-readonly the file first. Add this line to the end of the file:

c:\linux.bin="Linux"

Save and now you have a boot option to linux anytime from the Windows Boot Manager. This doesn't break when you update your Windows etc. Well, it does if you shift your HDD around (if the sda6 or whatever the naming changes.).