Level: Introductory Thomas Burger (twburger@bigfoot.com), Owner, Thomas Wolfgang Burger Consulting
01 Dec 2000 The author likes Linux best, but sometimes a job for a client or access to an old data format requires the use of those other so-called operating systems. Installing a new operating system over your old one and then switching back again is a painful process. Alternatively, devoting an entirely new computer to an OS you use only occasionally is not a realistic option for most of us. The solution is to make one computer capable of booting any of a number of operating systems from a menu when you first start the machine. Linux is very adaptable to this, and with a few changes can share the same machine with one or more other operating systems.
Most of the instructions for making a computer multi-OS capable are like the Steve Martin joke about how to get a million dollars and never pay taxes. (Step one: Get a million dollars.) Many of the planning steps and preliminary requirements are left out or only vaguely alluded to. This article will try to explain all of the planning and set-up required before installing the multi-boot system. Before you begin
To install multiple operating systems on a single computer, the details of hard drive organization must be understood. Readers familiar with the boot process, hard drive formats, and partitioning can skip ahead to Step 1.
What are partitions?
A partition is a physical section of a drive that can be logically formatted for a desired file system or is used to create further logical divisions. There are three types of partitions: primary, extended, and logical. There can be up to four primary partitions on a single drive. A primary partition cannot be broken down into smaller units and is used primarily as the location of an operating system. An extended partition is also a primary partition. It differs in that it has the extended capability of being broken down into logical partitions. This allows the drive to be organized into multiple logical divisions in excess of the four primary partition limit. Each partition can be logically formatted to support the file systems that a particular operating system requires.
The boot process
The "boot" process comes from the term "boot strap". It is a play on the concept of pulling one's self up by one's own boot straps. What actually happens is that when the computer is powered up, the CPU runs the startup code implanted in the system's ROM BIOS (Read Only Memory Basic Input Output System). This startup program contains the code that tests the computer and sets up the hardware for use. Its last step is to load and run a program stored on the first sector of the first drive. This is the master boot record (MBR), and the program is the master boot program (MBP). The MBP looks to see where the primary partitions are and which one is set as the active partition. The active partition has its own boot record, and this contains a program designed to start the operating system located on that partition. A partition boot record is usually referred to as the partition root superblock.
Step 1: Back up everything!
It cannot be stressed enough: take the time to back up all the files on the drive before attempting to make major configuration changes to the boot process. The following steps will change the fundamental method of loading the operating system to the computer. A single mistake will render the hard drive inaccessible, and there is a possibility that files will not be recoverable. It is best to back up a complete image of the hard drive if you have the capacity. If not, at least back up data files that cannot be easily reproduced, such as resumes, pictures, databases, and accounting files.
Step 2: Confirm the old and new OS media, and create a boot floppy disk
After backing up all of the important files and before making the changes, make sure that the sources of the existing operating system and the new OS to be installed are on hand and complete. This includes updates, patches, utilities, and service releases. They should all be on hand on easily accessible media. Easily accessible means in a format that can be loaded without complicated driver setups. A floppy diskette is best. Nothing is more frustrating than to be halfway through an installation and discover you have an older copy of a release file on the floppy and the new one is on the hard drive you can not access at this time or that your cousin Vicky borrowed the latest kernel release CD and you are stuck until she comes back from camping.
Before altering the hard drive, please make sure that the bootable floppy is available with the utilities required to restore the drive if problems occur. A typical problem occurs when a new Linux user is trying to keep Windows 95 on the same machine on which Linux is to be installed. The Linux installation goes well until the user is asked where to install LILO (the Linux loader program). Instead of placing LILO in the new Linux logical partition superblock, it is placed in the master boot record. When the computer is rebooted, neither Linux nor Windows 95 is available. The solution is simply a matter of having a WIN95 boot floppy with FDISK.EXE on it and, after booting from it, issuing the command FDISK /MBR to restore the master boot record from the copy LILO made.
Step 3: Repartition the drive
Different operating systems have different limitations on how and where they can be installed on the hard drive. Linux is probably the most adaptable OS for multi-boot systems. It will boot from both primary and logical partitions and from a secondary hard drive. Other operating systems have very limited abilities when it comes to the type and location of their partitions. The most common limitation is the offset allowed to the start of the partition superblock. In some cases the limitation is at the 1024 cylinder boundary of the hard drive. This depends on the size and type of hard drive, the file format, the computer's BIOS, and the operating system.
Partition requirements of some operating systems
Operating Boots from Root Partition Approx. Has to be
System Primary or Superblock Format Space on First
Logical Drive Boundary Needed Drive
Linux Either 8 GB Linux Ext2 250 MB No
OS/2 Either 4 GB FAT or HPFS 110 MB No
DOS Primary 2 GB FAT 8 MB Yes
Windows 95 Primary 8 GB FAT or FAT32* 90 MB Yes
Windows 98 Primary 8 GB FAT or FAT32 175 MB No
Windows NT Primary** 8 GB FAT*** or NTFS 117 Yes
Windows 2000 Primary 8 GB FAT, FAT32 or NTFS 600 MB Yes
Notes:
* Only the Windows 95 OEM Service Release 2 version supports FAT32.
** NT needs only the NT boot files NTLDR, NTDETECT.COM, and BOOT.INI in
the primary partition.
*** NT cannot use FAT32 partitions.
Due to the flexibility of Linux and the limitations of other operating systems, it is best to place Linux in a logical partition and on a secondary hard drive if available. This allows maximum flexibility for using other operating systems and allows Linux to preserve the MBR for the use of other operating systems.
To create or modify the hard drive partitions, there are several programs available. For Linux there is Linux FDISK and Disk Druid. Make sure that you have the latest version. Older versions can cause partition tables to be unreadable to other operating systems. The newer versions of Linux FDISK and Disk Druid will not cause problems. Commercial programs are more powerful and will allow moving, resizing, merging, and reformatting of partitions as well as creating and deleting partitions. One of the best is Partition Magic from PowerQuest. This program runs under Windows and Linux and will allow almost any change to the hard drive without disturbing the operating systems, programs, and data already on the drive.
Step 4 (last): Configure the OS selection
There are three ways to manage the selection of an operating system:
- Use a boot management program
- Configure a dual-boot system managed by an OS
- Manually set an OS "active" using a utility to mark the partition as active or manually editing the master boot record
Boot management programs offer the most flexibility and the ease of menu selection. The program is installed in the MBR of the primary hard drive, replacing the OS boot program that would simply select the active partition and load the OS boot program from the root superblock. Two programs that can do this are Boot Manager from IBM and BootMagic from PowerQuest.
Dual boot configurations can be created using LILO in Linux and Windows NT's boot loader. The OS loader can be changed so that when it starts, an alternate OS can be selected. This works very well and does not require the purchase of additional software. A moderate degree of technical knowledge is required to reconfigure the OS loader to load alternate operating system. See Resources for additional information.
DOS FDISK or PowerQuest PQBoot command-line utilities can alter the active partition attribute so that the OS on the primary partition selected on the first physical hard disk is allowed to load. This is a useful method for those who only wish to change operating systems only occasionally. It does limit selection to the primary partitions of the first hard drive.
Hardware-based options
An alternative to all of the complexity of creating new partitions and setting up OS boot selections is to reconfigure the computer to attempt booting from media other than the hard drive. Most new computers can be set up in the BIOS configuration to attempt booting from not only the floppy drive but from the CD ROM drive and SCSI devices. There are limitations as to what can be run this way, and often there are technical difficulties.
Linux and other CD ROM-distributed operating systems are bootable from the CD ROM drive, with limitations. No version of Windows will function from the CD ROM as it is a read-only device.
Floppy disk boots are slow but flexible. If you usually run Linux but also require occasional use of Windows NT, an NT boot disk can be created by formatting a diskette in NT and copying the NT boot files NTLDR, NTDETECT.COM, and BOOT.INI to it. When the computer boots, it will find the NT partition and load NT.
An excellent alternative if you can afford it and the computer is capable of doing so is to boot from large capacity removable media like an Iomega Zip or Jazz drive. Changing the OS is simply a matter of changing the removable disk.
Swappable hard drives offer the ultimate in hardware-based OS selection. The drawback is the very high cost involved.
Conclusion
The ability to select from two or more operating systems at boot time will save the cost of a second machine to run the alternate OS or the time required to delete and install a new OS. Changing the machine to allow the selection of multiple operating systems can involve a lot of work: changing the partitions of a hard drive, adding or changing software, and changing the master boot record. This software approach is complex but manageable with proper planning. It also has the advantage of being inexpensive or even free.
Hardware solutions using removable or swappable media are simple, but can be very expensive. Options such as booting from a floppy or a CD ROM drive are slow and have limitations.
Resources Learn
-
The article "Boot loader showdown: Getting to know LILO and GRUB" (developerWorks, August 2005) shows how these two popular boot loaders stack up against each other.
-
The tutorial "Getting to know GRUB" (developerWorks, January 2001) shows how to install and use GRUB.
-
The tutorial "Build a Linux test network" (developerWorks, May 2003) shows how to combine Samba and GRUB to build a compact, highly adaptable, cross-platform test network, capable of booting and networking a large number of operating systems on a small number of machines.
-
"Boot Linux from a FireWire device" (developerWorks, July 2004) explains how to boot Linux from a removable drive (breathing new life into old machines).
-
"Tip: Dual-booting Linux" (developerWorks, April 2002) explains how to install multiple instances of Linux on a single box.
-
"Lightweight Linux, Part 1" (developerWorks, October 2002) shows you how to build LILO.
-
Find more resources for Linux developers in the developerWorks Linux zone.
Get products and technologies
-
Pick up the latest LILO.
-
Get the latest version of the GRUB boot loader, and take a look at GRUB2 as well.
-
Order the SEK for Linux, a two-DVD set containing the latest IBM trial software for Linux from DB2®, Lotus®, Rational®, Tivoli®, and WebSphere®.
-
Build your next development project on Linux with IBM trial software, available for download directly from developerWorks.
Discuss
About the author  | |  |
Thomas Wolfgang Burger is the owner of Thomas Wolfgang Burger Consulting. He has been a consultant, instructor, analyst and applications developer since 1978. He can be reached at twburger@bigfoot.com.
|
Rate this page
|