You are on page 1of 7

HOWTO multi-boot using Windows NTLDR If you want to try several Linux distros alongside Windows, this method

is a good way to achieve it, as it lets you multi-boot using just one simple menu. Why not just use Grub? Well, firstly Grub typically resides on the MBR, and booting through Windows leaves your MBR "clean" with the default Windows NTLDR boot loader. (Some AV's are reported to not like anything else taking over the MBR). Secondly, giving each distro their own independent boot loader means [in theory] you should be able to mix and match Grub and Lilo, by re-installing them off the MBR into their own /boot partition. I can verify that updating the kernel works perfectly. Each distro's /boot partition maintains their own data, with Grub automatically updating the "magic" section of menu.lst I wanted to try out all four Ubuntu variants; Ubuntu, Kubuntu, Edubuntu and Xubuntu - and also some other distros such as Fedora, openSUSE, Debian, Linspire, Mandriva etc. before selecting the "one Linux to rule them all". After a great deal of research, reading out-of-date guides and conflicting opinions, I found many articles and messages on various sites and forums saying how to go about multi-booting using the Windows boot loader, but none seemed to stitch everything together in one neat package. So I thought I write a HOWTO for anyone else interested in doing the same thing. --Tools you will find useful or need: Partition Magic (Windows) Norton Ghost 2003 + GDISK.EXE (Windows) or free/GPL tools: Qtparted (Linux) Partimage (Linux) fdisk (Linux) MBR520.ZIP (Windows) Either set of utilities ideally need to be run off a boot CD, floppies or USB. (It's safer that way.) You can download a rescue CD with the Qtparted and Partimage utilities from here: http://www.sysresccd.org More documentation for Partimage is available here: http://www.partimage.org To create your own boot CD, Bart's way to create bootable CD-Roms (for Windows/Dos) is a good place to begin: http://www.nu2.nu/bootcd/ This page contains everything you'd need to jump straight in: http://www.nu2.nu/bootcd/cdromsi/ Copy your [Norton Ghost rescue floppy] GHOST.EXE and GDISK.EXE programs into the bcd_cdromsi\bcd\cds\cdromsi\files folder, and also the [Partition Magic rescue floppy] PMHELP.DAT, PQMAGIC.EXE, PQMAGIC.OVL, PQMAGIC.PQG, PQPB.RTC and zABOUT.PQG files if you have them. Be aware that you shouldn't exceed 2.88MB, as bcd emulates a "super" floppy.

If you can't get or don't have fdisk (either for DOS or Linux), you could use this free utility: http://www.allthatcounts.com/comp/mbr.htm Which lets you save and restore your MBR. (Copy the files from the .zip into your cdromsi folder as well). If you need to update Norton Ghost 2003, you can download these two patches: http://pcsystems.princeton.edu/nav/ng2003b789_en.x86 http://pcsystems.princeton.edu/nav/ng2003b793_en.x86 Rename them as .zip's, then unzip them. Replace the contents of the 789 folder with the contents of 793. The GDISK.EXE and GHOST.EXE files are dated late 2003, and are the ones to include on your boot CD or floppy. The Readme will tell you how to update your Windows installation of Ghost. Step 1 - Planning your partitions Plan carefully how you're going to repartition your drive(s). Shrink your Windows partition to leave space after it, with Partition Magic or some other utility. Then create a logical partition (within an extended partition, within a primary partition) filling the empty space. Make sure you apply the action, then promptly delete the logical partition. This will let you fill up the empty space with as many separate logical partitions as you need. (It's the easiest and safest way of doing so.) For example, I wanted to fit a maxium of 13 distro's on my laptop's WD 120GB HD. I planned on allocating 6GB for Windows, 1GB of Linux swap space, and 6GB for each Linux distro. It's a good idea to have a FAT32 partition that you can use to exchange files between Windows and each Linux distro, as well as for backing them up. Next should come the Linux Swap partition, typically twice the amount of RAM you have (or a maximum of 2GB). Then a /boot and / partition for each distro. Say, approx. 144MB for the /boot partition and 6000MB for the / partition. One way to do it, is to start assigning the Linux distro partitions from the right, working your way left. After you've added the Swap partition, you're then left with the [previously unknown] amount of space for your common FAT32 partition. The reason the FAT32 and SWAP partitions should "go first" is because then their device allocation (eg. /dev/hda6) won't change. If you created them last, or to the right, each time you added a distro under them, that device allocation would change - which is not a good idea! Using up only the two primary partitions (one for Windows, the other for all the logical drives) means you've got two spare for other boot-loaders or unusual installations (such as Damn Small Linux) which insist on having one or more primary partitions available. (You can always shrink the large extended partition to allow room). For example, here's a breakdown of the partitions I created, allocating 6GB for each of the four Ubuntu distros: Code: [1] [2] [3] [4] [5] PRI NTFS 6149MB "WINXP" (hda1) EXT LBA LOG FAT32 ~33494MB "FAT32" (hda5) LOG SWAP 1024MB "SWAP" (hda6) LOG EXT 149MB "UBU-BOOT" (hda7)

[6] LOG EXT [7] LOG EXT [8] LOG EXT [9] LOG EXT [10] LOG EXT [11] LOG EXT [12] LOG EXT [13] LOG EXT

6001MB "UBUNTU" (hda8) 149MB "KUB-BOOT" (hda9) 6001MB "KUBUNTU" (hda10) 149MB "EDU-BOOT" (hda11) 6001MB "EDUBUNTU" (hda12) 149MB "XUB-BOOT" (hda13) 6001MB "XUBUNTU" (hda14) 6149MB {pre-allocated ready for next distro}

+ remaining empty space in logical partition Don't create more than twelve partitions, as the graphical partition editor in the Ubuntu installer won't be able to see them, as it doesn't have a scroll bar. Step 2 - Save the Windows boot loader (NTLDR) If you don't have GDISK or FDISK, you will need to save the Windows boot loader (NTLDR) residing in the MBR at this point. Use the GETMBR utility to save it to the common FAT32 partition, eg. GETMBR C:\NTLDR (don't use more than five characters for the filename). If you've already tried installing GRUB or LILO, and don't have the original Window's MBR (or can't use the FIXMBR utility off the XP installation CD), you might be able to restore it with the GENERIC files that come with with MBR520.ZIP package, although I haven't verified this. Step 3 - Install the distro Boot the Ubuntu live CD, then install it to HD. On the "Install - Prepare disk space" screen, select "Manually edit partition table", skip past the "Prepare partitions" screen, then on the "Prepare mount points" screen, make sure you allocate the correct mount points and partitions for the distro, eg. the first distro's slots would be /dev/hda6 for the swap, /dev/hda7 for /boot and /dev/hda8 for / Where you see something like /media/hda3, change it to /media/fat32, so you will be able to write to the common FAT32 partition later. Blank all the other mount points and partitions out by scrolling to the top blank entry in each item list, for example: Code: Mount Point / /boot swap 6Gb Size Partition Reformat Y

Partition 8 Disc IDE/ATA 1 (Logical) [hda8]

149Mb Partition 7 Disc IDE/ATA 1 (Logical) [hda7] Y 1Gb Partition 6 Disc IDE/ATA 1 (Logical) [hda6] Y

/media/fat32

33Gb

Partition 5 Disc IDE/ATA 1 (Logical) [hda5]

After the initial installation is complete, click on the System Update icon (which should be flashing or otherwise announcing itself). Apply all the updates, then restart - as the circular blue arrow icon recommends. Step 4 - Moving boot loader from MBR to the /boot partition

At this point, Grub will have installed itself by default into the MBR, so select the [default] latest kernel option and wait for Ubuntu to finish loading. You then need to edit the /boot/grub/menu.lst file (possibly known as grub.conf on other distros). Open a console, and make a backup first: Code: sudo cp /boot/grub/menu.lst /boot/grub/menu.lst_backup Then use Gnome's GEDIT to open it: Code: sudo gedit /boot/grub/menu.lst Change the timeout value (from 10) to 3 and unhide the hiddenmenu by removing the single # character in front of it. Scroll down to the bottom, until you reach the "## End Default Options ###" section. Below it, there will be several "paragraphs", typically the top two representing the latest kernel, the next two the previous kernel, and the last one memtest86+ Remove the two previous kernel boot options if you wish. For Kubuntu, Edubuntu and Xubuntu, change the default title name of "Ubuntu" to the correct respective title. Scroll down right to the bottom, until you see the "### END DEBIAN AUTOMAGIC KERNELS LIST" section. Remove everything after that line, as you won't be using Grub to boot into Windows. For example, you should be left with something that looks like the following: Code: ## ## End Default Options ## title Kubuntu, kernel 2.6.15-25-386 root (hd0,8) kernel /vmlinuz-2.6.15-25-386 root=/dev/hda10 ro quiet splash initrd /initrd.img-2.6.15-25.386 savedefault boot title root kernel initrd boot title root kernel boot Kubuntu, kernel 2.6.15-25-386 (recovery mode) (hd0,8) /vmlinuz-2.6.15-25-386 root=/dev/hda10 ro single /initrd.img-2.6.15-25.386 Kubuntu, memtest86+ (hd0,8) /memtest86+.bin

## END DEBIAN AUTOMAGIC KERNELS LIST ## It's important to leave the start and end of the Automagic Kernels section alone, because then Grub can automatically update the boot options when the kernel is upgraded. Save the file and return to the console prompt, then type:

Code: df to double-check which device allocation your /boot partition is on. Look for /boot in the "Mounted on" column, then scan left to find the /dev/hda{n} identity. Note that it should be one less than the / identity in the menu.lst file, ie. if / is /dev/hda10, then /boot should be /dev/hda9 Issue the command: Code: sudo grub-install /dev/hda9 (don't worry about the "bug in xfs_freeze" comment that might be displayed). This has now installed the Grub boot-loader in your /boot partition, so it can safely be removed from the MBR, and replaced with the Windows boot loader again. We now need to copy the first 512 bytes of the /boot partition, and output them into a file which the Windows boot loader can use to bounce into the correct Linux distro. Use the command: Code: sudo dd if=/dev/hda9 of=/home/{user-id}/Desktop/ubuntu.lnx bs=512 count=1 then copy it over to the common FAT32 partition. Or you might be able to create it directly with: Code: sudo dd if=/dev/hda9 of=/media/fat32/ubuntu.lnx bs=512 count=1 Close the console, then restart the computer, booting up your rescue CD or floppy. If you're in a KDE desktop, such as Kubuntu uses, you might need to go about things slightly differently, due to permission controls not letting you edit the menu.lst file directly. Open a console, then type: Code: cd /home/{user-id}/Desktop sudo cp /boot/grub/menu.lst /boot/grub/menu.lst_backup sudo cp /boot/grub/menu.lst menu.lst Right-click -> Open to edit the menu.lst file on your desktop, then apply the changes as detailed above. Save it to your desktop under a different name, such as menu.lst.new, then copy it back into its original directory with: Code: sudo cp menu.lst.new /boot/grub/menu.lst

Step 5 - Restoring the Windows boot loader (NTLDR) After booting to your rescue CD or floppy, restore the Windows boot loader using Norton Ghost's GDISK with:

Code: GDISK 1 /MBR or by using the MBR520 package's RESTMBR utility. Remove the boot CD/floppy, then restart and go back into Windows. Step 6 - Copy the distro's boot loader file to C: Using Windows Explorer, copy the ubuntu.lnx file from the common FAT32 partition into the root directory of C: Step 7 - Editing the BOOT.INI file Open a DOS prompt, typically by selecting RUN off the start menu, then entering CMD in the input box. Change to the root C:\ directory, then set the attributes of the BOOT.INI file by editing it in Notepad with: Code: cd \ attrib -h -s -r BOOT.INI notepad BOOT.INI Reduce the timeout value (in seconds) from 30 to 10. Underneath the last "multi(0)disk(0)..." line, add the line: Code: c:\ubuntu.lnx="Ubuntu Linux" For example, after adding several distros your BOOT.INI file could look like this: Code: [boot loader] timeout=10 default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS [operating systems] multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows XP Pro" /noexecute=optin /fastdetect c:\ubuntu.lnx="Ubuntu Linux" c:\kubuntu.lnx="Kubuntu Linux" c:\edubuntu.lnx="Edubuntu Linux" c:\xubuntu.lnx="Xubuntu Linux" c:\fedora.lnx="Fedora Linux" c:\opensuse.lnx="openSUSE Linux" c:\mandriva.lnx="Mandriva Linux" c:\debian.lnx="Debian Linux" c:\gentoo.lnx="Gentoo Linux" c:\linspire.lnx="Linspire Linux" Note that the filename you use for the .lnx files should follow the standard 8.3 DOS format (ie. don't

use more than eight characters). The text inbetween the quotes can be as long as you like, within reason. I found it better not to include the kernel version, preferring to leave that for the [hidden] Grub menu that follows. Something short works best. When you've finished adding distro's, you should hide the BOOT.INI file again with the command: Code: attrib +h +s +r BOOT.INI After restarting, you should be presented with the Windows boot loader screen, like this: Code: Please select the operating system to start: Windows XP Pro Ubuntu Linux Kubuntu Linux Edubuntu Linux Xubuntu Linux Fedora Linux openSUSE Linux Mandriva Linux Debian Linux Gentoo Linux Linspire Linux Use the up and down arrow keys to move the highlight to your choice. Press ENTER to choose. Select the distro you've just installed, and it's boot loader should start up. By removing the # character in front of the hiddenmenu command (in the menu.lst file), it's menu options won't be displayed. If you want to see them, quickly press the ESC key (you will only have 3 seconds to do this!). You can then boot into recovery mode or run the memtest86+ utility. The advantage of using the Windows boot loader to control everything, is that in every day use you will only see the one boot menu - which is more elegant than going through two or possibly three (if you have Vista installed as well... but that's a whole other nightmare!) Verify that your chosen distro boots up as expected, then proceed to install as many other distros as you'd like, in a similar fashion. Note: if you ever find you can't boot into Windows, you might need to activate the [first] Windows partition. Using Norton Ghost's GDISK.EXE utility, this can easily be done with the command: Code: GDISK /1 /ACT /P:1 {END}

You might also like