How to Setup Dual Boot Systems

©2003 by Wayne Pollock, Tampa Florida USA.
All Rights Reserved.

Table of Contents
Boot loader Overview 
Linux boot loaders: LILO and GRUB 
Windows boot loader 
Solaris boot loader 
How to Make a Linux Boot Floppy 

Boot loader Overview

A boot loader is a small program used to load an operating system (or "OS") from disk into RAM, pass the OS various parameters, and finally start running the OS.  All operating systems use such a loader.  The boot loader is found by the BIOS code.  It may be on a boot-floppy, in the MBR (master boot record), or in the boot-blocks of any bootable partition.

There are many different boot loaders available.  Some provide GUI menus and many options, others provide no interface at all.  For example the first sector (512 or 4096) bytes of the Linux kernel contains boot loader code, so if a Linux kernel is copied onto a floppy disk the kernel will boot!  Fancy commercial boot loaders are available such as "Boot Magic" (comes with "Partition Magic") and "System Commander".  MS Windows and Solaris each come with boot loaders that can be somewhat configured to provide a menu of bootable partitions.

If a boot loader is installed in the MBR and a problem arises, the system will not be bootable.  For such a situation it useful to keep a DOS bootable floppy disk around containing the DOS program "fdisk.exe".  The DOS version of fdisk allows an (undocumented but widely known) option.  Running "fdisk/MBR" will over-write the MBR with a fresh, vanilla version.  Hopefully this will allow at least one of your operating systems to boot normally.  You can then use various tools to fix the problem.  (A boot floppy for each of your installed operating systems kept near the server is a handy precaution to take.)

Linux boot loaders: LILO and GRUB

The most flexible (and common) boot loaders are "LILO" and "GRUB".  Of these LILO ("LInux LOader") is older and less powerful.  Originally LILO did not include a GUI menu choice (but did provide a text user interface).  To work with LILO an administrator would edit the file /etc/lilo.conf, to set a default partition to boot, the time-out value, which choices should appear in a menu, kernel parameters, which partition to mount as the root partition, whether or not to initially load a RAM disk, where LILO should be installed, and other information.  (See the man page for "lilo.conf".)  After editing this file the administrator must then update the loader by running the lilo command.  Doing so updates either the MBR or the boot blocks (according to where lilo.conf says the loader is to be installed).

GRUB is a bit easier to administer because the GRUB loader is smart enough to locate the /boot/grub/grub.conf file when booting.  So an administrator only needs to install GRUB once, using the "grub-install" utility.  Any changed made to grub.conf will be automatically used when the system is next booted.  (See the info page for grub for details.)

Linux systems must use a Linux-aware boot loader, usually LILO or GRUB.  If you setup a dual-boot system and choose to use some other boot loader, say a commercial one or the Windows boot loader, you must also use LILO or GRUB.  In this case you would install your main boot loader in the MBR, and the Linux boot loader in the boot-blocks of the Linux bootable partition.  When the main boot loader runs and the user chooses to boot Linux, rather than try to run the kernel directly the main boot loader will look for a (secondary) boot loader in that partition's boot blocks.  (Note in this setup the secondary boot loader is usually configured to not display a menu, although it certainly can be setup that way.)

Even today some home PCs and portable computers ship with hardware for which only Windows drivers are available.  This situation is changing but it may be a problem for some home users (on a server who cares about video or sound cards).  One way to deal with this situation is to setup a bootable DOS partition that contains the correct drivers.  Then you can put a special command "LOADLIN.EXE" as the last statement in the AUTOEXEC.BAT file.  LOADLIN is a program that will boot a Linux partition without re-initializing the hardware.  So you can use this setup to load in DOS, which then initializes your hardware, then load in Linux.

Back to top of document

Windows boot loader

Linux and Unix can access FAT and FAT32 partitions.
A kernel update is required for Linux to access NTFS (Solaris can’t).
Windows installers destroy non-MS partitions,
so you must install Windows first.
For Win9x (including ME), you can use lilo or grub in the MBR.
To use grub:
1.  fdisk the hard drive and make a partition for Windows XP and
    leave whatever you want to allocate to Linux unpartitioned.
2.  Install Windows XP onto this partition.
    (This should be a primary partition!)
3.  Boot to the Linux install CD and partition the remaining
    unpartitioned part of the HD and install Linux.
    (Install GRUB into the MBR, it should detect both OSes.)
4.  Reboot and enjoy your new dual boot system.
5.  Sometimes grub only detects one OS.
    The fix is simple, add the following lines to the
    /etc/grub.conf file to show the WinXP OS too:
      title Windows XP
          root (hd0,0)	      or rootnoverify (hd0,0)
          makeactive	      or nothing
          chainloader +1

As it says in the grub.conf file, you do not have to restart grub
(as you do with LILO) for the changes to take effect.
Simply save the file and reboot.
WinNT, Win2K, and WinXP have issues with the MBR,
they get upset if it is altered and WinXP will check it
occasionally and overwrite whatever is there.
The easy way to deal with this is to use a commercial boot loader
that supports modern Windows OSes and Unix/Linux.
(Grub is able to do this.)
Or you can use a boot floppy for Linux (and CD for Solaris).
Just install the Linux boot loader in the boot blocks of the
bootable partition, not in the MBR.

You can configure the WinXP boot loader to boot either
Windows or Linux (not for the faint of heart).
First to display the root (“/”) partition device name:

    # rdev

Next, copy the boot sector (disk block) of the root partition
to a file using dd:

    # SECTOR_SIZE=512 # or 4096
    # dd if=/dev/hda8 bs=$SECTOR_SIZE count=1 of=/boot/bootsec.lin

Then you must modify /etc/lilo.conf (or /etc/grub.conf) to
write to this file and not to the boot sector as it normally would.
In lilo.conf add (or modify) the “boot=” line to read:

Finally, copy this file to your WinXP partition
(say at C:\bootsec.lin) and add the following line to
the XP BOOT.INI file (don’t ask me where it is, I don’t know):

Back to top of document

Solaris boot loader

Partition the drive to leave at least 2GB of space available for Solaris;
more drive space is desirable.
As with Linux, install Windows first then Solaris.
Do not use the Installation CD but boot and install
from Software CD 1.
If you accept the default partitioning scheme which
the installer provides you will soon run out of space in
your / and /usr partitions since only enough space is
allocated to install the system.
All extra space is allocated to /export/home.

A typical installation on a 4.5GB partition might look
something like this:
    Filesystem          Size  Used Avail Use% Mounted on
    /dev/dsk/c0d0s0     900M  536M  310M  64% /
    /dev/dsk/c0d0s1     334M  109M  192M  36% /var
    swap                671M  8.0k  671M   1% /var/run
    swap                671M  8.0k  671M   1% /tmp
    /dev/dsk/c0d0s5     845M  222M  565M  29% /opt
    # (FAT32 partition):
    /dev/dsk/c0d0p0:1   5.0G  3.3G  1.6G  66% /c
    /dev/dsk/c0d0s7     1.1G   92M  954M   9% /export/home
    /dev/dsk/c0d0s4     752M  225M  474M  33% /usr/local

The Solaris boot selector enables you to choose either
Solaris or Windows with Solaris as the default.
(I prefer grub or lilo!)

To mount FAT under Solaris:
    # mount -F pcfs /dev/dsk/c0d0p0:c /dos  (or “:1”?)

And the vfstab file:
    /dev/dsk/c0d0p0:c - /dos pcfs - yes -

To create a GRUB boot floppy, follow these steps:
    $ mkfs -t ext2 /dev/fd0
    $ mount /dev/fd0 /mnt/fd0
    $ mkdir /mnt/fd0/boot /mnt/fd0/boot/grub
    $ cp /boot/grub/stage[12] /boot/grub/grub.conf  \
    > /mnt/fd0/boot/grub
    $ /sbin/grub --batch <

The following is a posting from Netnews that describes how to work around a possible problem with a Solaris dual-boot system:

Subject: Re: multibooting Solaris8(x86) and Linux
Date: Mon, 15 Jul 2002 22:26:18 +0100
From: "David Williams" 
Newsgroups: comp.unix.solaris

"Paul Floyd"  wrote in message
> As I said, there are two things that Solaris fdisk gets wrong: partitions
> not on (conventional) cylinder boundaries, and CHS values filled with
> crap. The former of these two cannot be fixed other than by deleting the
> partition. The latter of the two can be fixed by various methods.
> Presumably the 'fix-table' option does something to the put CHS
> values that match the LBA values. What it won't do is move the
> partitions to be on cylinder boundaries.
> Moving the partition is a rebuild job!
> If you use a functional fdisk to create your partitions, then install
> Solaris, it will probably do its party trick and shit on the CHS values,
> but at least it will not change the partition geometry. The
> solutions that I've used for this are to manually edit the PT, and to
> make backups of the PTs and restore them after installing Solaris.

I have partition magic on 2 floppies!!
I did a:

  - Delete Solaris partition using Linux fdisk

  - Recreate using Partition Magic (which puts
    the right CHS values in AND start it on a cylinder
    boundary! Linux fdisk works but does not care if
    a partition starts on cylinder boundaries!

  - Exit partition magic and change back to the
    first Partition Magic floppy.  This first floppy
    has PTEDIT.EXE on it which displays:
      - Partition Type
      - Active Flag
      - CHS start/end values
      - LBA start/end values
    Note all values down!

  - Reboot into Sun CD

  - Re-create Solaris slices inside Solaris fdisk partition

  - Reboot to Partition Magic and get weird error code
    and Partition Magic won't touch the disk!

  - Run PARTTINFO.EXE from Partition Magic floppy
    THE CHS values are now wrong

  - Use 1st floppy of Partition Magic which has
    PTEDIT.EXE on it to repair the values

  - Reboot into Solaris CD and restore Solaris partition
    using cpio.

  - Use installboot to make Slice 8 bootable

  - Reboot back into Partition Magic and the CHS
    values are wrong again!

  - Use PTEDIT to correct the CHS values again!

  All is ok now

  - Reboot into Partition Magic and the partition magic
    is happy with the disk.

  - Use PARTINFO.EXE from Partition Magic Floppy
    and see all the values are correct

I'm happy now but it was a long weekend!

> If in the future you have a partition tables with Sun's geometry, then
> even if you fix the CHS values, I don't think that you will be able to
> use a tool like Partition Magic on the disk.
> --
> Paul Floyd        (for what it's worth)

Back to top of document

How to Make a Linux Boot Floppy

To make installation boot floppies for systems that can’t boot CDs, mount the CD on a Windows machine, say as drive D:.  Then enter:

	D:\dosutils> rawrite
	      src name: ..\images\boot.img
	      target: a:

Or, Under Linux use:

        # uname -r # (or use -v instead)
        # mkbootdisk -v version

or under any Unix/Linux system:

	# dd -if=boot.img of=/dev/fd0 bs=1440k

Note that typical Linux systems today assume IDE controllers.  If you have SCSI you may need a bit more work to make a proper boot disk (see the "initrd

Back to top of document

Send comments and questions to
Valid HTML 4.01!   Valid CSS!   CAST: Bobby WorldWide Approved 508   CAST: Bobby WorldWide Approved AAA