Booting Linux using Windows Boot Manager

Adding an entry on BCDEDIT we can boot Linux using Windows (Vista or later) Boot Manager. As earlier OS such as Windows XP does not have bcdedit we can boot Linux by adding entry on boot.ini file.

For Windows Vista or Later, using BCDEDIT

Let’s discuss how to do this. First, we shall install Windows on the target PC. Then we shall take a backup of Windows MBR before installing Linux.

# dd if=/dev/sda of=winmbrbackup.bin bs=512 count=1

After that we shall install Linux. Then we restore Windows MBR.

# dd of=/dev/sda if=winmbrbackup.bin bs=446 count=1

In this stage, we install Linux MBR on Linux partition using grub-install command

# grub-install /dev/sdaX

For example, it is ‘sda9’ in my case.

# grub-install /dev/sda9

Let’s copy required boot information: mbr into a file which we will use later on Windows.

# dd if=/dev/sda9 of=rhelmbr.bin bs=512 count=1

Copy this file from Linux and put it into system partition such as C: drive.

We shall add an entry in Windows BCDEDIT for Linux. We have to open command prompt with administrator privilege and apply following command,

$ bcdedit /create /d "RHEL 6" /application BOOTSECTOR

This command will give an ID of the entry created. Use this ID on subsequent commands,

$ bcdedit /set {ID} device partition=C:
$ bcdedit /set {ID}  path \rhelmbr.bin
$ bcdedit /displayorder {ID} /addlast
$ bcdedit /timeout 20

If you are using Windows 8, it’s better to set bootmenupolicy to legacy so that OS Selection Menu is displayed during initial boot.

$ bcdedit /set {default} bootmenupolicy legacy

After restarting operating system you will be presented with option to boot Linux with Windows.

Earlier OS such as Windows XP

Opening boot.ini for edit can be little bit tricky. It might be set read-only. The file resides on C:\ drive. Windows XP boot.ini looks like this:

$ bcdedit /set {default} bootmenupolicy legacy[boot loader]
timeout=30 
default=multi(0)disk(0)rdisk(0)partition(1)\WINNT 
[operating systems] 
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Microsoft Windows 2000 Professional" /fastdetect

Add a line like this in boot.ini to add linux entry,

C:\rhelmbr.bin="RHEL 6". 

References

Leave a comment