Thursday, January 15, 2009

Dual Boot Windows and Linux










This might seem like a dry topic, afterall everyone knows how to use grub to dual boot a system. However, how many people know that you can use the Windows bootloader for the same purpose. Moreover, I would argue that this is fundementally the right way to do it for most users for the following reasons
  • Linux is multiboot friendly, it won't generally trash your MBR unless you ask it
  • Linux programs are not MBR sensitive, the version of Partition Magic I had (as well as an old version of Norton System Works) both volunteered to "fix" my bad MBR. By which they meant kill my Linux login.
  • When you update windows you won't kill your Linux install
  • Everyone dual boots from grub, get yourself a little street credit

Of course if you are in a community where Windows is considered an evil, then even using the NT loader may be considered bad. However, everyone I show my system to says "hey how do I do that?" BTW if you are using grub and want to make Windows the default just move it up to the first slot.

Just to give you an idea what you are in for you will

Reinstall Grub not to the MBR (or whatever linux boot loader you want).

  • For example run Grub with the right parameters

Get a copy of the boot loader

  • Run dd

Fix your windows install so it owns the boot record

  • (install, repair)

Create the entry for dual booting.

A detailed list can be found at http://port25.technet.com/archive/2006/10/13/Using-Vista_2700_s-Boot-Manager-to-Boot-Linux-and-Dual-Booting-with-BitLocker-Protection-with-TPM-Support.aspx.

However, there are a couple of short cuts. Note, most of this requires admin privlidges. Sudo is useful on Ubuntu and Debian linux distros.

For Step 1:

  • We will follow this as is. Simply install Linxu but DON'T put the boot in the MBR

For Step 2:

  • Copy the boot sector dd if=/dev/sda1 of=/tmp/linux.bin bs=512 count=1 (NOTE the drive is the drive you installed the linux boot to). This can be found by fdisk -l which should show a partition with system = Linux.
  • Modern Linux distros can mount an NT volume read write, there is no need to use a USB or floppy for the copy.
  • You can also follow the alternative instructions at http://www.highlandsun.com/hyc/linuxboot.html it sounds like a cool way to do it.

For Step 3:

  • You can probably user the repair function, if you have an existing Windows install. That is what I did.

For Step 4:

  • Follow http://support.microsoft.com/kb/289022 to edit boot.in
  • Or do
  • C:> cd \, C:> attrib -h -r -s boot.ini, C:> notepad boot.ini
  • Add a line "timeout=30" to the top
  • Add a line "c:\ubuntu.lnx="Ubuntu Linux" to the bottom

There you have it, a dual boot that starts with the Windows Boot Loader.






No comments: