You're at work. Your boss turns his unsuspecting head. You click the Start button, choose Shut Down, and select Restart. The BIOS posts, and instead of going straight into the land of blue screens and page faults, you are greeted with a mysterious
“What does it mean?” asks a curious coworker. You smile and wink. “It means that I know what I'm doing,” you retort in absolute earnestness. You press [Enter] and watch with childlike glee as your workstation boots into Linux! You know that you’re about to become the most productive drone in the office. The OS boots, and you’re finally greeted with:
You have the choice between working in console like the super geek you are or diving headlong into the beautiful land of X Windows. Of course, you choose to command the crown of coolness and type startx. Your coworkers gawk and drool and wish—oh, so wearily—that they were you.
The day goes by, and you compute, compute, compute. Finally, word comes down that Big Boss is coming your way! You drop your cursor to the Gnome panel, click the main menu, choose log out, and click restart. The machine reboots. The BIOS posts, and at that mysterious
you type dos.
Big Boss walks up to your desk and notices that Windows is rebooting. He asks what happened. “Blue Screen of Death,” you say. He nods. You look over your shoulder and see your coworker giggling in secret sympathy with your now racing heart. You know that, as soon as Jabba the Hutt is out of your sight, you'll be back in Linux-land, computing with ease and grace. Jabba hands you a pile of work and slithers off—back to the hole from whence he came.
The term “dual booting” is tossed around these days as if it were a household phrase. But what exactly is dual booting? And how is it accomplished? Dual booting is not some hyper-geek challenge to the talents of the unwitting masses. Dual booting is simply a means of allowing more than one operating system to exist on a single hard drive and an ability to boot into any of those operating systems. Unlike VMware (see “VMware—A Window within a Window within a Window”), dual booting doesn’t allow users to run more than one OS at a time. Instead, dual booting allows users to choose at boot which operating system they'd like to run. Although it may seem daunting, dual booting is very simple to set up.
Why dual booting?
Linux can dual boot with many operating systems. From OS/2 to DOS and the various incarnations of the Windows OS, Linux works well with all of them. In this Drill Down, however, I’m going to concentrate on the setup that the majority of users will want: Linux and Windows.
There are many reasons why people want to create dual-booting machines. The primary (and obvious) reason is that they need certain applications that are unique to one OS or another. Although both Linux and Windows have every application that a user could need to operate efficiently and successfully, each OS offers a unique type of computing. Windows has its ease of use, and Linux has raw power and flexibility. How can you benefit from both? The answer lies in the inherent design of each OS. But let's concentrate on the subject at hand—dual booting.
The key to using Linux as a dual-booting system is in the order of installation. Both Linux and Windows have unique boot-managing devices. Unfortunately, only one has a device with even a modicum of intelligence. The LILO (Linux loader) boot loader was created so that Linux could work well with other OSs. And it does just that.
How it works
As we all know, different operating systems use different file structures. (Linux uses ext2; Windows 95/98 uses fat32; NT uses fat16.) Also, all OSs are installed on partitions. Obviously, each partition must be of a totally different type, and neither system can talk to each other, right? Wrong! Fortunately, Linux can read and write to most file system types, and LILO is allowed to take charge of the boot process easily and seamlessly.
After the BIOS posts (assuming that both OSs were set up correctly and that the LILO boot manager was installed correctly), control is transferred to LILO, which reads a file in the /etc directory (it’s located on the Linux partition) that has a “map” of the hard drive. This map tells the boot loader where each OS is located. It looks something like this:
/etc/lilo.conf maps out a dual-booting Linux/Win98 drive. It’s a 4-gig drive inside of a Celeron 366 laptop, with Win98 on the first partition (/dev/hda1) and Linux on the second partition (/dev/hda6). There’s a reason for this layout. Due to a lack of “intelligence” in the Windows boot loader, the loader must reside (or “think” that it resides) on the primary drive (or partition), or else it won’t boot. Therefore, it’s imperative that the installation process follows the outline below.
Step-by-step installation instructions for Linux/Win98 dual-boot machine
Before you continue, please make sure that you BACK UP YOUR DATA AND THAT YOU VERIFY THAT BACKUP!
The first step assumes that you’ve set up a Windows drive and that you don’t wish to destroy any of its data. (We'll outline the full installation later.) There are two ways that you can make room for Linux: through third-party proprietary software or through the FIPS application. Although the FIPS utility is distributed freely (it’s included in many Linux distributions), it isn’t recommended. It’s too complicated, and it isn’t 100% foolproof. You’ll be better off if you use a third-party proprietary application, such as Partition Magic, which will allow you to resize your Window partition without damaging the current data.
Once the Windows partition has been resized and there is sufficient space for a good Linux installation (for instance, a complete Red Hat installation, including all X Windows tools, Server Tools, applications, and documentation, will need 1300 MB), it’s simply a matter of rebooting the machine with the Linux distribution CD and running through the standard installation process. During this process—depending on which distribution you've chosen and what type of installation you’re running (custom, workstation, or server)—you may be prompted for placement of LILO. Typically, workstation installations place LILO into the Master Boot Record (MBR) of the disk automatically. The installation of LILO is crucial to successful dual booting. During certain installations, the user will be prompted to select placement for the LILO boot manger.
For a Linux/Win9x dual boot, LILO must reside on the MBR of the disk if you want a simplified, efficient booting process. Having LILO positioned on the MBR will ensure that your system recognizes both OSs. If LILO resided on the main Linux partition, it would be necessary to boot with a floppy, which leads to a much slower, more cumbersome process than standard booting.
When the installation is complete and LILO is properly placed, it’s time to reboot the machine. Take out all of the boot media and installation CDs and restart the machine. After the BIOS posts, LILO will offer the following prompt:
At this point, users have a few options: they can hit [Tab] for a listing of available OSs (and their respective invocation commands), they can press [Return] to boot the default OS (which would be Linux), or they can type dos (which invokes the Windows 98 OS). If the default OS is chosen (either by pressing [Return] or by typing linux and pressing [Return]), the Linux boot process will begin, and it will end with the login prompt:
Now, users should enter the login name, followed by their passwords. If the dos option is chosen, the Windows startup process will begin, and everything will run as a standard 9x startup.
The beauty of the LILO boot loader is that it keeps all the OSs isolated from each other. Once an operating system is called from LILO, 100% control is given over to that OS; there is no interaction between OSs. If the user calls dos, the standard Windows 98 boot procedure will be invoked.
Linux/Win9x full installation
Now, let’s focus our attention on installing both OSs on an empty disk. The first step in preparing for this installation is to boot from the proper boot disk and to transfer system files to the hard drive. The tool that will be implemented here is fdisk. You can use the fdisk tool to create the necessary Windows partitions while leaving enough “free space” for Linux. (You can complete this procedure based on a percentage or on actual size.) After the Windows partition is created, you shouldn’t do anything with the remaining free space. Don’t partition this space in any way; leave it “free.”
CAUTION: The following information assumes that you have backed up all of your important information from the hard drive. fdisk erases partitions, thereby erasing all existing data. Back up and verify your backup. Don’t use fdisk unless you understand all of the possible ramifications.fdisk is a tool that allows users to delete and add various types of partitions to a hard drive. The easiest way to run fdisk on a new (empty) hard drive is to use the Windows 98 boot disk and to type fdisk at the A:\> prompt to begin the fdisk process.First, accept large disk support (in case your hard drive is larger than 512 MB). Next, you’ll be offered the following options:
- Create DOS partition or Logical DOS Drive
- Set active partition
- Delete partition or Logical DOS Drive
- Display partition information
After the partitioning is complete, run through the standard Windows installation. (Refer to the “@” section above.) Continue with the Linux installation, and if you’re performing a custom installation, make sure that LILO resides on the MBR of the hard drive.
Linux/NT dual booting
The Linux/NT dual-boot process varies slightly because the NT boot loader must reside on the MBR (which means that LILO can’t reside there). Therefore, steps must be taken to ensure that the NT boot loader can locate and call up LILO.
The first step toward successful Linux/NT dual booting is to install NT as usual (with the exception of leaving ample space for the Linux installation). Once NT is successfully installed, it’s time to install the Linux OS. During the Linux installation, it’s critical that a boot disk be created during the installation. Since LILO has been placed on the /root partition of the Linux file system, the Linux OS will be unable to boot without the Linux boot disk.
Run the Linux installation as usual (with the exception of not being able to run any of the automatic workstation installations). For the Linux/NT dual boot, a custom installation must be used in order to ensure that LILO is installed into the proper location: the Linux root partition. Do not install LILO onto the MBR because the NT boot loader will be overwritten (thereby rendering NT unbootable).
Once Linux has been installed properly (with LILO resting comfortably in the root partition), it’s time to start the dirty work that enables the NT boot loader to recognize Linux as a bootable system.
The Linux side of the work
After the Linux installation is complete, boot Linux with the boot floppy that you created during the installation. Once you’ve entered the Linux system, run /sbin/rdev /boot/vmlinuz (as root) to discover the location of the boot sector of the Linux partition.
The first step is to peel the bootsector from your Linux-root partition. If /dev/hda (as discovered by the /sbin/rdev command above) is your Linux partition, the dd-command will be:
dd if=/dev/hda of=/bootsect.lnx bs=512 count=1
If the bootsect.lnx bs value is greater than 512, then there’s something wrong, and the dual boot won’t work.
After you run the dd command, copy the bootsect.lnx file to a DOS-formatted floppy. (Mount the floppy device and run the command cp /bootsect.lnx /mnt/floppy.) Then, unmount the floppy device and reboot the machine into NT (without the boot floppy). Now, copy the bootsect.lnx file onto the C:\ directory. At the dos prompt, change the permissions of the boot.ini file (with attrib -s -r c:\boot.ini) so that changes can be made. Open the boot.ini file in your favorite editor and add the following line at the end of the file:
Restore the permissions of the boot.ini file with:
attrib +s +r c:\boot.ini
You’re ready to reboot! When the boot process comes up, there should be a new entry called "Linux" under the previous NT entries. Highlight the new entry and press [Return]. You should be ready to rock!
Reboot the machine. You should be able to boot into either OS without the aid of a boot floppy. If things don’t work properly, you still should have your boot floppies, which will help you boot into either OS and start troubleshooting. The best troubleshooting method is to rerun peeling off the boot image and recopy the file over to NT. If this method doesn’t work, check the howto site and look for the NT OS Loader mini how-to for instructions on installing and running the Bootpart application. (It automates the last few steps of the process.)
Dual booting serves many purposes. It’s flexible, and it gives users the best of both worlds. If you have enough hard drive space, a machine can be set up to run Linux with practically any other OS or combination of OSs. With dual booting, application shortage and vast system-wide flexibility is not a problem.
Jack Wallen, Jr. is very pleased to have joined the TechRepublic staff as editor in chief of Linux content. Jack was thrown out of the "Window" back in 1995, when he grew tired of the "blue screen of death" and realized that "computing does not equal rebooting."
Prior to Jack's headfirst dive into the computer industry, he was a professional actor, with film, TV, and Broadway credits. Now, Jack is content with his new position of Linux Evangelist. Ladies and gentlemen—the poster boy for the Linux Generation!The authors and editors have taken care in preparation of the content contained herein, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for any damages. Always have a verified backup before making any changes.
Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website jackwallen.com.