MultiBoot Using NTLDR

download MultiBoot Using NTLDR

of 7

Transcript of MultiBoot Using NTLDR

  • 7/27/2019 MultiBoot Using NTLDR

    1/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 throughWindows 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 beable to mix and match Grub and Lilo, by re-installing them off the MBR into their own /bootpartition.

    I can verify that updating the kernel works perfectly. Each distro's /boot partition maintains theirown 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 theWindows 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 goodplace 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.

    http://www.sysresccd.org/http://www.partimage.org/http://www.nu2.nu/bootcd/http://www.nu2.nu/bootcd/cdromsi/http://www.sysresccd.org/http://www.partimage.org/http://www.nu2.nu/bootcd/http://www.nu2.nu/bootcd/cdromsi/
  • 7/27/2019 MultiBoot Using NTLDR

    2/7

    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 aswell).

    If you need to update Norton Ghost 2003, you can download these two patches:

    http://pcsystems.princeton.edu/nav/ng2003b789_en.x86http://pcsystems.princeton.edu/nav/ng2003b793_en.x86

    Rename them as .zip's, then unzip them. Replace the contents of the 789 folder with the contentsof 793. The GDISK.EXE and GHOST.EXE files are dated late 2003, and are the ones to include onyour 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 theempty 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 onallocating 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 Linuxdistro, 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 /bootpartition and 6000MB for the / partition.

    One way to do it, is to start assigning the Linux distro partitions from the right, working your wayleft. After you've added the Swap partition, you're then left with the [previously unknown] amountof 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 adistro 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 SmallLinux) 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 fourUbuntu distros:

    Code:

    [1] PRI NTFS 6149MB "WINXP" (hda1)

    [2] EXT LBA[3] LOG FAT32 ~33494MB "FAT32" (hda5)[4] LOG SWAP 1024MB "SWAP" (hda6)[5] LOG EXT 149MB "UBU-BOOT" (hda7)

    http://www.allthatcounts.com/comp/mbr.htmhttp://pcsystems.princeton.edu/nav/ng2003b789_en.x86http://pcsystems.princeton.edu/nav/ng2003b793_en.x86http://www.allthatcounts.com/comp/mbr.htmhttp://pcsystems.princeton.edu/nav/ng2003b789_en.x86http://pcsystems.princeton.edu/nav/ng2003b793_en.x86
  • 7/27/2019 MultiBoot Using NTLDR

    3/7

    [6] LOG EXT 6001MB "UBUNTU" (hda8)

    [7] LOG EXT 149MB "KUB-BOOT" (hda9)[8] LOG EXT 6001MB "KUBUNTU" (hda10)[9] LOG EXT 149MB "EDU-BOOT" (hda11)

    [10] LOG EXT 6001MB "EDUBUNTU" (hda12)

    [11] LOG EXT 149MB "XUB-BOOT" (hda13)[12] LOG EXT 6001MB "XUBUNTU" (hda14)[13] LOG EXT 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 installerwon'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'tuse the FIXMBR utility off the XP installation CD), you might be able to restore it with the GENERICfiles 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 "Preparemount 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 writeto 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 Size Partition Reformat

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

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

    /media/fat32 33Gb Partition 5 Disc IDE/ATA 1 (Logical) [hda5] Y

    After the initial installation is complete, click on the System Update icon (which should be flashingor otherwise announcing itself). Apply all the updates, then restart - as the circular blue arrow iconrecommends.

    Step 4 - Moving boot loader from MBR to the /boot partition

  • 7/27/2019 MultiBoot Using NTLDR

    4/7

    At this point, Grub will have installed itself by default into the MBR, so select the [default] latestkernel 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, thenext 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-386root (hd0,8)kernel /vmlinuz-2.6.15-25-386 root=/dev/hda10 ro quiet splashinitrd /initrd.img-2.6.15-25.386

    savedefaultboot

    title Kubuntu, kernel 2.6.15-25-386 (recovery mode)

    root (hd0,8)kernel /vmlinuz-2.6.15-25-386 root=/dev/hda10 ro singleinitrd /initrd.img-2.6.15-25.386boot

    title Kubuntu, memtest86+

    root (hd0,8)

    kernel /memtest86+.binboot

    ## END DEBIAN AUTOMAGIC KERNELS LIST ##

    It's important to leave the start and end of the Automagic Kernels section alone, because then Grubcan automatically update the boot options when the kernel is upgraded.

    Save the file and return to the console prompt, then type:

  • 7/27/2019 MultiBoot Using NTLDR

    5/7

    Code:

    df

    to double-check which device allocation your /boot partition is on. Look for /boot in the "Mountedon" 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 nowinstalled 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 slightlydifferently, due to permission controls not letting you edit the menu.lst file directly. Open a console,then type:

    Code:

    cd /home/{user-id}/Desktopsudo cp /boot/grub/menu.lst /boot/grub/menu.lst_backupsudo 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 intoits 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'sGDISK with:

  • 7/27/2019 MultiBoot Using NTLDR

    6/7

    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 rootdirectory 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 inputbox.

    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.INInotepad 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=10default=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

    /fastdetectc:\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

  • 7/27/2019 MultiBoot Using NTLDR

    7/7

    use more than eight characters). The text inbetween the quotes can be as long as you like, withinreason. 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 ProUbuntu Linux

    Kubuntu LinuxEdubuntu Linux

    Xubuntu LinuxFedora Linux

    openSUSE LinuxMandriva Linux

    Debian LinuxGentoo Linux

    Linspire Linux

    Use the up and down arrow keys to move the highlight to your choice. Press ENTER tochoose.

    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 (ifyou 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] Windowspartition. Using Norton Ghost's GDISK.EXE utility, this can easily be done with the command:

    Code:

    GDISK /1 /ACT /P:1

    {END}