How To: Dual Booting Linux & Windows On Separate Hard Drives Part 3
- 6 Comment
Overview
- Article 1 covers Introductory Information and Preparations necessary before You Install Any Additional Operating System.
- Article 2 covers System information collection, Necessary Data backup, and Installing Windows.
- Article 3 covers editing the boot information on each hard drive to make the Dual Booting Process seamless.
This article is part 3 of a series of three articles that detail how I got Ubuntu 64 Bit Hardy and Windows XP dual booting on my box while being installed on different hard drives. It differs from some dual booting methods in that I already had linux installed prior to installing windows. Just like anything else though, this method may not work for everyone as it is specific to my system configuration, and that plays a big part in setting up any software. But you may be able to find some bits that help you in your own undertaking.
Quick Overview Of the Boot Process
When the computer powers up, it performs a POST(Power-On Self Test) to initialize hardware and assess the system state. If everything goes well, the bios can look for an operating system to boot. It does this by searching the CMOS list of devices until it finds one that is bootable. When it finds that device, usually a hard drive that contains a boot loader located in the MBR(Master Boot Record), it enters stage1 of the boot loader. The stage1 boot loader(primary bootloader) then tries to find the secondary boot loader(stage2) by scanning the drive’s partition table looking for an active partition. If all goes well, after this the operating system is loaded.
Linux Boot Process
In linux, the first and second stage boot loading is performed by grub or similar boot loaders. Grub accesses the menu.lst file in the boot directory to see a list of the available kernels to load. You can then select your kernel preference or let the default load.
Windows Boot Process
Just like with linux, the bios finds the MBR on the hard disk. Then the NTLDR(Windows Bootloader) takes over. Windows needs to be on the root of an active partition — this is why it usually tries to overwrite other operating systems. Once the NTLDR takes over, it reads a series of files including boot.ini while preparing to load the kernel for the windows system. NTLDR can’t load the linux operating system, but it can provide a menu listing so that you can list other operating systems. This list can then be used to call a boot loader that understands how to boot the other operating systems.
Preparing Windows XP To Dual Boot
- Boot into windows and edit the boot.ini file located on the root of the C: drive. If the boot.ini file is not viewable on C:, unhide protected operating system files
- Open boot.ini and add the the line C:GRLDR=”Start Grub” to the end of the file. After WinGrub is installed, this line will call the GRLDR (grub loader) to initiate the linux boot process.
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)WINDOWS=”Microsoft Windows XP Professional” /noexecute=optin /fastdetect
C:GRLDR=”Start Grub” - Download and Install WinGrub. Installing with the default options is fine. Launch WinGrub. You might get some errors the first time you run it, but the errors didn’t adversely affect my system in any way and didn’t appear again after the first run.
- Now under general options, click the profiles drop down box and select default. After selecting this, the Menu Table should display something like Windows at (hd0,0). This will be important when we go to edit the menu.lst file in ubuntu, so write this down. It basically says that windows is located on the first hard drive, and on that hard drive it is located on the first partition.
- Now go back to the Profiles drop down box under general options and select dskboot. You should see some more information appear in the Menu Table.
- In the Menu Table box, click on the first line which should read something like: <load /boot/grub/menu.lst>. Some boot information should appear in the Title boxes. This information basically tells the system where to find grub and where to read grub’s menu.lst file. Now click the save button next to the profile box.
- Next, click the Tools Menu and select Install Grub. The following screen should appear:
- Now in the second box under Boot From, choose Boot.INI and click install.
- Grub should now be installed on your windows system and the windows menu list should be configured. Reboot the computer.
- You should see the following menu after the bios has transferred control to the NTLDR. If you choose windows, the windows operating system should load. If you choose START GRUB, the ubuntu menu should appear but the operating system probably won’t load quite right yet.
Preparing Ubuntu Linux To Dual Boot
- Select Start Grub from the windows boot menu.
- You should get a screen similar to the following. At this screen you want press c to go to the grub command line.
- At the grub command line, you need to find out the hard drive mapping for your linux system by typing find /boot/grub/stage1 at the prompt. You should get something like (hd1,0). Write this down. Press Esc to get back to the ubuntu boot menu.
- From the ubuntu boot menu, highlight the kernel you want to load (usually the first one), then press e to edit the selection. If the line that reads something like root (hd1,0) matches the mapping you found in the previous step, you are done with this step and can press the Esc key. If it doesn’t match, you must highlight the line and press e to edit it to match the mapping in step 3. Then press Esc until you get back to the ubuntu menu listing. If all goes well, you should be able to select the first kernel and Ubuntu should load.
- Now if you had to change the drive mapping for ubuntu to load, you are going to have to edit the menu.lst file located in /boot/grub/menu.lst. The menu.lst file will also have to be edited if you want to have the option to boot into windows from the ubuntu menu. So once ubuntu loads, open the terminal and type the following: sudo gedit /boot/grub/menu.lst — Now if you had to change the drive mapping to boot ubuntu, you need to change it in this file to make the change permanent so you won’t have to manually edit the listing every time. I just changed the mapping for all my kernels so I could boot into any one of them.
Output:
## ## End Default Options ## title Ubuntu 8.04.1, kernel 2.6.24-21-generic root (hd1,0) makeactive kernel /boot/vmlinuz-2.6.24-21-generic root=UUID=1fa7e8db-b92e-4f30-900f-d2ca3cb60d10 ro quiet splash initrd /boot/initrd.img-2.6.24-21-generic quiet title Ubuntu 8.04.1, kernel 2.6.24-21-generic (recovery mode) root (hd1,0) kernel /boot/vmlinuz-2.6.24-21-generic root=UUID=1fa7e8db-b92e-4f30-900f-d2ca3cb60d10 ro single initrd /boot/initrd.img-2.6.24-21-generic title Ubuntu 8.04.1, kernel 2.6.24-20-generic root (hd1,0) kernel /boot/vmlinuz-2.6.24-20-generic root=UUID=1fa7e8db-b92e-4f30-900f-d2ca3cb60d10 ro quiet splash initrd /boot/initrd.img-2.6.24-20-generic quiet title Ubuntu 8.04.1, kernel 2.6.24-20-generic (recovery mode) root (hd1,0) kernel /boot/vmlinuz-2.6.24-20-generic root=UUID=1fa7e8db-b92e-4f30-900f-d2ca3cb60d10 ro single initrd /boot/initrd.img-2.6.24-20-generic title Ubuntu 8.04.1, kernel 2.6.24-19-generic root (hd1,0) kernel /boot/vmlinuz-2.6.24-19-generic root=UUID=1fa7e8db-b92e-4f30-900f-d2ca3cb60d10 ro quiet splash initrd /boot/initrd.img-2.6.24-19-generic quiet
- Now to have Windows listed as a boot option in the Ubuntu menu, add this to the bottom of the menu.lst file. These lines just basically tell grub to transfer control to the NTLDR so windows can be loaded. Once you add these line, save the file. Then reboot to check that everything works.
title WinXP
rootnoverify (hd0,0)
makeactive
chainloader +1title WinXP is how the option will appear in the menu listing.
rootnoverify (hd0,0) tells grub not to attempt to mount the partition.
makeactive means to make the partition given in the rootnoverify line active.
chainloader + 1 just lets you specify mutiple systems and keeps track of enumeration so that you can always boot into your latest linux kernel.
Summary
This was all I had to do to get Ubuntu 64 Hardy and Windows XP to properly dual boot on my machine. For me this approach was definitely easier that others I’ve tried in the past. So now I have windows loaded for my art class and ubuntu linux loaded for my primary operating system. The only other thing I may use windows for is video editing. Kino and some of the other linux video editing options are great, but it would be nice to have an application that is a bit more stable.
KJ
Related Articles
6 Comments on this post
Trackbacks
-
Carla said:
Thanks for these detailed instructions. I’ve been wondering if something like this is even possible!
Carlas last blog post..How to sort it all out? (TMI)
September 18th, 2008 at 1:01 pm -
kj said:
No problem!
September 18th, 2008 at 1:17 pm -
Trevor said:
These instructions are exactly what I was looking for, and thanks for being so clear and precise! Please keep up the great work!
November 14th, 2008 at 11:16 am -
kj said:
Trevor, I’m glad you found the article useful!
November 14th, 2008 at 3:23 pm -
Oliver J said:
Thanks for the very clear (& well illustrated!) instructions on dual booting XP & Ubuntu. I appreciated the explanations you gave along the way…
I had wondered if there was a way of just setting up my bios to choose one HD or the other - rather than setting the dual-boot up within the Windows boot loader)?
November 26th, 2008 at 12:52 am
















[...] Article 3 covers editing the boot information on each hard drive to make the Dual Booting Process seamless. [...]