Index Software

Multi-booting

Basics

First off, some PC theory. When you turn on your PC, the first thing it does is start executing the BIOS code (and does some self tests). This is normally accompanied by messages on the screen and sometimes by some beeps (usually when something has gone wrong).

Once the BIOS has completed initialization and tests, it starts to boot. In modern BIOSes, you can normally select the boot order priority (hard disk, floppy, CD, Zip, network). If you have more than one hard disk, you can also usually select which one will be used to boot. Let's assume that we're booting from the first hard disk. The BIOS uses INT13 (an interrupt service routine) to read the Master Boot Record (MBR, the very first sector on the disk) into RAM, and starts executing that code. The boot sector code reads the partition table (see below) to determine which partition is active, and then reads the boot code from the first sector of that partition. In the past, there were limitations on how much disk could be accessed by INT13. No such limitations exist on current PCs.

In the case of some OSes, the boot sector code starts a boot manager (this is certainly the case for NT and Solaris, and I think is optional for Linux). Other OSes start directly from their boot sector code. I'm not certain that all OSes adhere to this method, but all the ones that I've ever installed do.

The Partition Table

Part of the MBR is the partition table. This table has 4 'rows' which describe the layout of up to 4 partitions on the hard disk. These are called primary partitions. For each partition, the partition table includes information about the type of the partition, some flags (whether the partition is active) and the start and end of the partition. Two methods are used, CHS (cylinder-head-sector) and absolute sector. CHS is stored in two bytes, 10 bits for cylinders, 6 bits for heads and 8 bits for sectors. This gives a limit of about 8Gbytes. The absolute sector is stored in 4 bytes, giving a limit of 2Tbytes.

You cannot have more than 4 primary partitions. If you want more than 4 primary partitions, then you either have to add more hard disks, or you have to do some very dirty low-level hacking of your partition table. In this way you could have, say, 5 partitions, but only 4 would be pointed to by the partition table. The alternative is to use extended partitions. I'm not too familiar with LVMs (logical volume managers). I imagine that they are a fancy form of extented partitions.

Extended/Logical Partitions

Virtually all OSes support the concept of extended partitions, though strictly speaking, this is a software extension rather than hardware/BIOS. The basic principle is that one of the primary partition entries in the partition table is given a special type (in fact, there are two, since Microsoft added a second one for "Large Disk Support"). The extended partition does not point directly to a block of disk, like an ordinary primary partition, but instead, it points to a logical partition table (LPT). This is pretty much the same thing as the MBR, except that only two partition table entries are used: the start of the logical partition associated with the LPT, and the next logical partition table. In this way, the logical partitions are daisy-chained, and are all contained within the extended partition. A similar approach is used by many PC unices like Solaris and FreeBSD to cleate slices within a PC primary partition.

There are a few rules that should be followed:

  1. Partitions should start and end on cylinder boundaries
  2. One active partition at a time
  3. No more than one primary partition of the same type
  4. Order of entries in partition table should match order of partition tables on disk
  5. CHS values should match absolute sector values, if they are under 8G, and should be set to their max values otherwise

Don't forget that the MBR takes up one sector so the 'cylinder boundary' for the first partition is offset by one sector.

Booting

So, what if you want to install more than one OS? You can have up to 4 primary partitions, so no problem there. But how do you choose which one to boot? Well, there are several techniques, which cover a range of simplicity, from crude to sophisticated.

BIOS control

With more than one hard disk you can usually twiddle your BIOS settings every time that you boot (by pressing a key like Del). This still limits you to just one OS per disk (which is OK I suppose if you just have two disks and two OSes). In the long run, rather slow and tedious!

Removeable Media boot

Boot from a floppy or CD, which then transfers control to an OS of your choice. Without the floppy/CD, you still boot your default OS. Typically, this would be for a Windows user who installs Linux on a second partition, but does not install a boot manager.

Boot Manager software

There are a lot of these. As a rule, you boot to a menu or a prompt, and then you select your OS to boot. Often they require a partition of their own (like lilo, OS/2 boot manager, Solaris boot partition). PowerQuest BootMagic requires a Fat16 or FAT32 partition, which in my book counts as a wasted partition as well. FreeBSD has a very basic boot controller that allows you to select other partitions on the same disk, or the first disk. It is not user configurable. I've never used Ranish or System Commander, but they generally seem well regarded. I have used OS/2 boot manager, BootMagic, NT boot loader, Solaris boot manager (not the separate partition version), lilo and grub. Of these, OS/2 boot manager and BootMagic I can recommend. lilo is quite powerful, but tricky to configure. NT bootloader can be quite effective, though it's also a bit tricky. At the present, both of my PCs use grub to boot (my old PC even chains two levels of grub to boot Solaris, as I have never gotten round to adding all of the config to the Solaris grub and making it active).

For quite some time (at least, from Solaris 7 until some time after Solaris 10 was launched), Solaris came with its own boot manager. This could work in one of two ways. Either it could have a partition of its own. I have never tried this, but it was supposed to allow some degree of configuration. Alternatively, without a dedicated partition, it would be more or less limited to the active hard disk, with the ability to choose other than the default partition, with a fixed timeout. Not very sophisticated really.

I should check the date, but off the top of my head in mid 2006, Sun changed the default boot manager to be grub. They had to adapt the code so that it can read Solaris UFS [and, it being GPLed, they committed it back to the maintainers, curiously, I've net heard of Red Hat or SuSE picking it up and thus enabling booting Solaris from one of their installations]. There was a bit of a painful transition via patches, since this affected much of the boot sequence. But now it's just a more or less bog standard grub.

My old PC does have one complication. It does not boot off the 1st SCSI LUN (which is 1), but from LUN 8. This combined with the fact that I have an old old ld copy of DOS on disk LUN 5 means that the grub entry to boot DOS is very complicated (with partition hiding and disk swapping). I've never managed to get the DVD drives to be visible to DOS.

Creating your partitions

I recommend creating your partitions before you install. (Exception: some upgrade versions of OSes include a "sniffer" that looks for something to upgrade from. These can usually be fooled quite easily). Most OSes have some sort of partition tool (fdisk), and my experience with DOS/Windows fdisk, OS/2 fdisk and FreeBSD fdisk is that they all work fine. At one point I had one partition table with a small error in it (a partition that exceeded the CHS limit didn't have the maximum value set for one of the fields). This caused Linux fdisk to calculate totally bogus values for the CHS values for the disk. Not very reassuring. Partition Magic is even easier to use. The exception to the rule is Solaris fdisk. DON'T USE IT! I've used Solaris fdisk from Solaris 7, 8, 9 and 10, and the results are always the same: catastrophe. If you create a partition with Solaris fdisk, then you're likely to end up with a geometry that is compatible with Solaris SPARC disk geometry (roughly at least). This is useless. Slaris SPARC UFS and Solaris x97 UFS aren't even compatible. And nobody but nobody in the wolrd of PCs wants such a geometry. Sun doesn't think that we need CHS entries in our partition tables. Not playing by the rules means that Solaris fdisk at the worst will damage other partitions and render your partition table impossible to edit with other fdisks or Partition Magic. I found that the only thing to do with a partition created by Solaris fdisk is to delete it. I do hold out some home that the OpenSolaris community will be able to drive 'PC compatibility' into Solaris fdisk.

So, if you're installing Solaris, use an fdisk that works to create a blank partition and a backup of your partition table before you start installing.

Next, you can start installing. I recommend that the first attempts at installation are only experimental, in order to find out how much space you need, if there are any hardware problems and so on.

I'm not aware of too many conflicts. Here are a few possibilities.

  1. Solaris UFS and Linux swap both use the same filesystem ID *.
  2. DOS/Windows needs to be on C:
  3. Solaris likes to be on the first boot disk
  4. Installing Solaris can change Linux slice numbering

* As of Solaris 10, the partition ID for UFS has changed, and no longer conflicts with Linux swap.

To expand a bit. If you install Linux after Solaris, it's possible that it will try to use your Solaris partition(s) as swap disk, and destroy your installation. I had no problem with SuSE Linux, though others have reported problems. You can workaround this by setting the Solaris partition to another filesystem type, installing Linux, then resetting the Solaris filesystem type.

The drive lettering of DOS, Windows and OS/2 is a pain. OS/2 is a bit more flexible since it can be installed on a drive other than C: (as can NT and family). You need to remember the rules for letter assignment: primary partitions in BIOS order, then logical partitions in BIOS order. That means disk 1 primary partitions, then disk 2 primary ... disk n primary, then back to disk 1 for logical ... disk n logical. The OS will only assign letters for filesystems that it recognizes. So, imagine that you create an NTFS partition as your 2nd primary on a disk (primary 1 being blank). NT installs on what it thinks is C:. If you then go and make primary 1 a FAT16 DOS partition, NT will then think that its NTFS partition is D:, and it very likely won't boot (unless you make the 1st partition FAT16 hidden).

Fooling Solaris into installing is not a problem. This can be done either with the BIOS or by simply unplugging other disks.

The Linux partition problem with Solaris is very similar to that of Windows drive lettering. There are two possible workarounds: install Solaris on a partition that is physically after the Linux partition, or rebuild lilo and /etc/fstab to reflect the changed partition labels.

More tips

Once you've installed, don't go moving around SCSI HBAs. Some OSes won't boot if you do that.

OS/2 and Linux can be installed in logical partitions. If you only have one big disk (or want to install a ridiculous number of OSes like me), then this can be very useful.

Make sure that you have a boot diskette with utilities (fsck for a linux boot diskette, chkdsk for a Windows diskette).

OS/2 doesn't like Windows large disk extended partitions. You can always reset the partition type to 05, but there is a danger that Windows might mess up your disk. Alternatively, there are some new OS/2 disk drivers that recognize the Windows type 0F extended partitions.

Backup your data

My Experience

Back in the early nineties when I first started multibooting, I used OS/2 bootmanager. At the end of the nineties, I bought my second PC and started using BootMagic. A few years ago (2002 or 2003), I decided to reclaim the space that was wasted with a Windoze 98 install that hosted BootMagic, and switched to using grub. grub is quite powerful, but not very easy to use. In particular, if your system does not fall into the cases covered by the documentation, then unless you are a bit lucky in your trial and error experimentation, then you'd better get scrurrying to usenet. One thing that amuses me about grub (and LILO) is the so-called multiboot specification that it implements. I've never had any real problem with OS/2, DOS or Windows, which all use the simple but effective mechanism of reading the partition boot sector into memory and executing it. From there they load more code from the same partition, and off goes the boot process. Solaris does much the same. Multiboot/grub/LILO has a much more complicated (and powerful) mechanism, in which the bootmanager can pass parameters to the kernel that it is booting. This does require grub to be able to read the filesystem of the OS that it is booting, and the OS to conform to the 'standard'. It also greatly complicates the grub/LILO config files. Without this complication, grub would be about as simple as the Windows NT family boot.ini file. My view is that this is passing complexity on to the user that could be handled by the boot loader.

Tools and links

I recommend Partition Magic (the link will take you to Symantec's web site - they bought PowerQuest. ptedit is a must-have, and can be downloaded from the same web site. It runs under DOS and Windows.

DFSEE is excellent. It used to be free (versions 3.xx), but since version 4 it is shareware.

Copyright © Paul John Floyd 2004 - 2007

Valid HTML 4.01!