White Bar

"I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. "

   -Linus Torvalds

    Aug 25 1991

Copier

Multi-Booting  by Ryan Martin

BACKGROUND
            In OS world, multi-booting is a very valuable capability that allows a user to install and use more than one OS at a time.  This is accomplished by using a boot loader; every operating system has a boot loader.  NTLDR (abbreviation of NT Loader) is the boot loader for Windows NT, including some of its later versions (2000/XP/2003). NTLDR does not appear in Windows Vista, which divides the functionality of NTLDR between two new components: winload.exe and the Windows Boot Manager.” (http://www.wikipedia.com/)  In the Linux world there are two main boot loaders: LILO (Linux Loader) and GRUB (GNU GRUB).


            LILO is an older loader which “was originally developed by Werner Almesberger, while its current developer is John Coffman.  LILO does not depend on a specific file system, and can boot an operating system (e.g., Linux kernel images) from floppy disks and hard disks.” (http://en.wikipedia.org/wiki/LILO_(boot_loader)


            The current boot loader preference among Linux ditributors is GNU GRUB  which was “developed from a previous package called the GRand Unified Bootloader (a play on grand unified theory). GRUB can run on any operating system with a Multiboot kernel. It is predominantly used on Unix-like systems; the GNU operating system uses GNU GRUB as its boot loader, as do most general-purpose Linux distributions.” (http://en.wikipedia.org/wiki/GRUB)


            For the purpose of this presentation, we will deal with GRUB in the context of Ubuntu Linux version 6.10 (aka Edgy Eft).  GRUB is an incredibly flexible boot loader.  It was primarily designed to work with multi-boot kernels such as the Linux kernel, but it also works with non-multi-boot kernels such as the Windows and OS/2 kernels by means chain loading.  Chain loading is the process of transferring boot process control from one boot sector to another.


            GRUB progresses through two stages during boot-up.  Stage 1 is either loaded on some type of removable media (floppy disk, thumb drive, etc.) or in the Master Boot Record (MBR) of the first hard disk (HDD).  When stage 1 runs it transfers control to stage 1.5 which bridges to stage 2.  Stage 1.5 is optional.  The difference between stage 1 and stage 1.5 is that stage 1.5 understands the ext2fs file system whereas stage 1 does not.  Stage 2, witch generally resides on a hard drive, then loads a kernel and passes control of the boot process to it, or (in the case of Windows) passes control to the chainloader.  Grub can be configured to display a list of possible kernels to load, or be setup to load a certain kernel by default.  GRUB has a simple command line interface (CLI) which can be used to pass custom parameters for the kernel at boot time as well.  Debian derived distributions such as Ubuntu store the GRUB configuration in /boot/grub/menu.lst which is a text file.

Dual-Booting

 

            Now that we know the basic theory of boot loading, lets take a look at how to setup a simple dual-boot with Windows and Linux.  In order to install multiple operating systems on a single system, there must be multiple partitions or disks in the system.  Partitions can be created with any partitioning program such as Disk Druid, Partition Magic, fdisk, etc.  Ubuntu and Windows both have their own partitioning programs included in their installer.  Once you have your partitions established, follow these steps:

  1. Install Windows on the first disk/partition.
  2. Install Linux on the following disk/partition(s).

 

            By installing Linux last, GRUB will overwrite NTLDR and be used as the default boot-loader and it will automatically create an entry in the GRUB configuration file (menu.lst) for Windows under the heading of Other Operating Systems.  If you install Linux first, Windows will overwrite the MBR with NTLDR and GRUB will have to be loaded manually afterwards. 

Customizing:

            By default Linux will be the first entry in the GRUB menu (and menu.lst file).  By editing /boot/grub/menu.lst, the order of the list can be customized to personal preference.  Be advised, however, that improper modification of the menu.lst file will result in an unbootable system.  It is a good habit to make a backup copy of the menu.lst file before editing it for recovery purposes.  This can be done with the copy (cp) command as follows:
            $ cp /boot/grub/menu.lst /boot/grub/menu.lst.bak. 

Triple-Boot (a personal experience)

 

            If you have the desire to install three operating systems, GRUB can accommodate you.  I decided to try a triple-boot after purchasing a new HDD for my main desktop at home.  I had installed Windows XP x64 and Ubuntu 64bit in the dual-boot configuration that is outlined above.  After adding the new drive I installed Windows Vista Ultimate x64 RC2 just for kicks and giggles.  Vista installed without a hiccup.  However, upon rebooting I realized that GRUB was nowhere to be found.  I didn't want to lose my Ubuntu install, so I broke out my trusty Live CD and booted into Ubuntu, opened a terminal and fired up the GRUB command line.


            $ sudo grub

 

At this point I had to find out where my stage 1 files resided.

 

            grub> find /boot/grub/stage1

 

This command returned (hd1,3) which indicates which drive (hd1) and partition (3) contain the stage1 GRUB files.  Next I used the output from “find” to set my GRUB root, which tells GRUB where to look for the stage1 files.

 

            grub> root (hd1,3)

 

Now that GRUB knows where to look to find the stage1 files, I need to install GRUB to the MBR.  The setup command does that nicely.

 

            grub> setup (hd0)

 

The preceding command tells GRUB to install its self in the MBR of the first HDD.  I could've had it install in the /boot partition of my Linux disc by substituting (hd3,2) for (hd0), but I wanted GRUB in the MBR.  Once setup has been executed, quit the GRUB command line.

 

            grub> quit

 

After a reboot, GRUB was back in command of the boot process.  However, Vista didn't show up in the boot menu.  XP was still there, so I tried to boot into it.  At that point the chainloader became apparent as it passed boot control not to NTLDR, but to Vista's Window's Boot Manager which gave a different boot menu with Vista and XP in it. 

FURTHER READING

 

            For a more detailed set of instructions on GRUB and how it works, go to http://users.bigpond.net.au/hermanzone/p15.htm#Re-install_Grub_with_Live_CD

Place Holder