You are visitor number ????? since 2 August 2009

Go to Howard Kaikow's home page

This document attempts to trace thru the steps necessary to create a multiboot Windows/Ubuntu system, using the built-in Windows boot loader NTLDR to boot Ubuntu as well as Windows 2000/XP.

This methodology should apply to both Windows 2000 and Windows XP, and versions of Linux that use the GRUB boot loader. I do not believe that this technique will work with Vista..

I will describe the details of my most recent install of Ubuntu 9.04.

Partitioning for Ubuntu

Prior to installing Ubuntu 7.04, in 2007, I used Partition Magic to create the partitions necessary for installing Ubuntu..

For Ubuntu 9.04, I decided to create the partitions during the install of Ubuntu 9.04, using the partition manager from within Ubuntu. However, when I then rebooted to Windows, Partition Magic indicated that the physical drive was "BAD". Note that Windows, itself, and the Perfect Disk defragmentation program had no problems recognizing the partitions on the drive. Obviously, Parition Magic does not play nicely with other partitioning programs, at least not with the one within Ubuntu.

So, I had to boot with the Ubuntu Live CD, delete the Linux partitions, then boot to Windows, and use Partition Magic to pre-create the partitions, then go back and re-install Ubuntu.

You may have better luck with Acroinis Disk Director, or some other partition manager.

My system has 4 hard drives. I created 4 partitions on the 4th hard drive. During the install, I assigned the partitions as follows:

And, I designated that Ubuntu be installed in /dev/sdg6.

This article is based on Ubuntu being installed in /dev/sdg6, which turned out to be (hd3,5). If your drives are different, you will have to change the numbers accordingly.

To facilitate communicating between Linux and Windows I had created a small FAT32 partition on my drive 3, which turned out to be (hd2,5). Note that it is only a coincidence that (hd2,5) and (hd3,5) both use 5 as the 2nd parameter. It just worked out that way for my partition configuration.

Installing Ubuntu

When you install Ubuntu, do NOT allow the boot record to be recorded in any MBR (Master Boot Record), rather instruct GRUB to write the boot record within the partition in which you have installed Ubuntu. In this case, /dev/sdg6.

At this point you will NOT be able to directly boot to Ubuntu, but you need to verify the install, and verify a piece of information.

You will need to download the Super Grub Disk(SGD) from http://www.supergrubdisk.org/.

Read the info at the SGD web site on building, and using the SGD.

Also, download the script at http://www.supergrubdisk.org/w/index.php5?title=Support_Rules#Run_partition_layout_option.

If the install of Ubuntu was done correctly, you will be able to INDIRECTLY boot to Ubuntu via the SGD's Boot Indirectly option.

If successful, run the partition layout script as follows.

Open a Terminal window.
$cd to the directory in which you saved the script.
$sudo bash boot_info_script032.sh

In my case the relevant output was:
fdisklu
6 (hd2,5) FAT 3GB Windows
6 (hd3,5) extt2ts 8GB Ubuntu 9.04 \n \l
7 (hd3,6) ext2fs 8GB
8 (hd3,7) ext2fs 4GB
pause SGD has succeeded!
SGD has succeeded!

This confirms the important piece of info that Ubuntu is installed in (hd3,5).

Editing menu.lst

Now comes the tricky part. While still booted to Ubuntu, edit the /boot/grub/menu.lst file as follows. Save the old copy, just in case.

The end of menu.list will have something like:

# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sdd1
Title Windows NT/2000/XP (loader)
rootnoverify (hd3,0)
savedefault
makeactive
map (hd0) (hd3)
map (hd3) (hd0)
chainloader +1

Change that to:

# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sdd1
title Windows NT/2000/XP (loader)
rootnoverify (hd0,0)
makeactive
chainloader +1

The Secret Sauce!

And now, for the secret of all this. While still booted to Ubuntu, open a Terminal window and type the following:
$ sudo grub
type your password
grub> device (hd0) /dev/sdg
grub> device (hd3) /dev/sdg
grub> root (hd3,5)
grub> setup (hd0,5)
grub> quit
$ sync
$ reboot

The above is based on Ubuntu being installed in /dev/sdg6, which turns out to be (hd3,5). If your drives are different, you will have to change the numbers accordingly. When you reboot, you will still have to use the SGD to get to your Ubuntu, don't fret, only 1 more step to go!

Copy the boot sector, the final step!

Since my Ubuntu is on /dev/sdg6, I used the following from a Terminal window in Ubuntu to make a copy of the GRUB boot sector.

sudo dd if/dev/sdg6 of=/media/MicronM/grubboot446.lnx bs =446 count=1

I copied only the first 446 bytes, as is recommended by some. I also made another copy using

sudo dd if/dev/sdg6 of=/media/MicronM/grubboot512.lnx bs =512 count=1

I then copied grubboot446.lnx to the C drive (in Ubuntu speak, /media/MICRONC) as grubboot.lnx (filename does not matter).

Note that /media/MICRONM is the FAT32 partition that is on my M drive in Windows using the drive name MICRONM.

I could have moved the file directly to /media/MICRONC in Ubuntu, but, for now, I will not write to an NTFS drive from Ubuntu. I feel safer moving the file to the C drive from within Windows, but that's just my preference, not necessarily a requirement.

Add the following to the C:\boot.ini file, use the filename you placed on the C drive.
C:\grubboot.lnx="Ubuntu Linux"

Remove the SGD from the drive.

Reboot, and the boot menu should now allow you to boot to Ubuntu.