"Linux Gazette...making Linux just a little more fun!"


A Linux Journal Preview: This article will appear in the April 1998 issue of Linux Journal due out this month.


Windows/Linux Dual Boot

By Vince Veselosky


So you've heard great things about Linux: faster, cheaper, more efficient, more stable. Sounds good. You'd like to try it out, but probably have a lot of time and data invested in Windows and can't afford to be down while figuring out how to use Linux for your daily tasks. Windows and Linux can live comfortably on the same computer, even on the same hard drive. The choice of operating system can be made when you power on. This is commonly called a ``dual boot'' configuration, and one of the most common questions among new Linux users is how to set it up.

My system is a Pentium II 400MHz with 128MB of RAM and an 11GB EIDE (actually Ultra-DMA 33 ATAPI, for you hardware gurus) hard drive. The hard drive had Windows 95 ``C'' on one big FAT32-formatted C: drive, which is a typical factory configuration. I tested installs of Red Hat Linux 5.1 and SuSE Linux 5.2.

Before starting, there are two terms you need to be familiar with: partition and file system. The disk can be divided into smaller, separate pieces which can belong to different owners. For dual booting, Windows will own some and Linux will own others. The word ``partition'' does not refer to the wall; it refers to the separated space. Thus, we say Windows is installed ``on'' the first partition. The file system is a method of organization. Your hard drive can have different file systems. The operating system provides the directory tree (also referred to as ``the file system'') as a catalog of available files. Every operating system has its own type of file system, and other operating systems often don't know how to read it. Lucky for us, Linux is a versatile operating system and it does understand the file system used by Windows 95 and Windows 98.

Making Room for Linux

Most factory-installed Windows installations take up all the space on your hard drive, leaving no room for installing Linux. The first and most difficult thing we must do is clear some space where Linux can be installed. Linux needs to have partitions of its own, but Windows does not have the ability to resize partitions. Ordinarily, this would mean you would have to delete your existing partition (and everything on it) to make room on the drive and then create partitions of smaller sizes and reinstall. You can still do this, but there is a better way.

What You Need

Most Linux distributions come with a special tool to allow you to resize or divide hard drive partitions. Called FIPS, the First (non-destructive) Interactive Partition Splitter, it is normally found on your Linux CD in a directory called /dosutils. You will also need a blank, formatted floppy disk to use as a boot disk. For most older Windows installations, that should be all. However, if you have Windows 98 or a recent version of Windows 95 with a large hard drive (bigger than 2GB), you may need some additional tools if you are using the FAT32 file system.

To check what type of file system Windows is using, open Windows Explorer, right click on the C: drive and choose Properties. If you see ``File System: FAT32'' on the General tab, you will need some additional tools to support this newer file system.

FAT32 Support Requirements

To adjust your partitions, you will need version 2.0 or higher of FIPS. If the version included with your Linux distribution is older than this, the latest version is available for download from the FIPS home page at http://www.igd.fhg.de/~aschaefe/fips/. If you want to share files between Windows and Linux (a good idea), you will also need to have version 2.0.34 or higher of the Linux kernel. Table 1 is a list of Linux distributions known to support FAT32. If your distribution does not include support, you will need to upgrade the kernel. Upgrading a kernel is beyond the scope of this article, so check the documentation included with your distribution or your distributor's web site for information about how to do that.

Table 1. Distributions with FAT32 Support

Distribution: Earliest Version with FAT32 support
Red Hat Linux: Version 5.1 (kernel 2.0.34)
SuSE Linux: Version 5.3 (kernel 2.0.35)
Debian GNU/Linux: Version 2.0 (kernel 2.0.34)

Preparing Your Drive

Before you can resize your Windows partition, a few steps must be taken to ensure that the process goes smoothly. First, delete any files from your hard drive that are not being used; for example, any old files in the C:\windows\temp folder, and then empty your recycle bin. Next, check your file system for errors using Scandisk, and compact your hard drive using Defrag. I'll assume you Windows users know how to do this. When running Scandisk, be sure to check the box next to ``Automatically Fix Errors''. Defragmentation consolidates all your data at the ``front'' of the drive to make room at the ``back'' of the drive for your new partition.

When both are finished, it would be wise to note how much space is available on the disk. If this number is less than the amount required to load Linux (check your distribution's documentation for space requirements), you'll need to delete more files or uninstall some software to make room.

Using FIPS

Before using FIPS, you must read the FIPS.DOC text file which accompanies the program. The use of the program is not entirely obvious, and you may need the background information the documentation provides. Also, while running FIPS you should carefully read all the messages it displays. They will provide valuable information on the steps you will need to take next. Most importantly, FIPS comes with no warranty. Although it has been used safely many times, there is always the chance it could damage the data on your hard drive. If you value your data, back it up before you begin.

For safety, create a DOS or Windows boot disk to work from. To do this, click Start -> Settings -> Control Panel. Double click ``Add/Remove Programs'' and select the tab called Startup Disk. Press the button and follow the instructions.

Next, copy the working files for FIPS to the floppy. The files FIPS.EXE, RESTORRB.EXE and ERRORS.TXT are mandatory. You may also want to copy the documentation files included with FIPS. When your data is backed up, restart your computer and boot from the new floppy.

When you arrive at the A:> prompt, type FIPS and press enter. A warning will appear about using FIPS in multitasking environments like Windows. Since we booted from a floppy, we are safe, so press enter. FIPS will analyze your existing partitions. It may pause for a long time at ``Checking FAT'' and ``Searching for Free Space''; this is perfectly normal, so just wait. The bigger your hard drive, the longer it will take. When FIPS is done with its analysis, it will display the results. You may get a warning of something being wrong with your FAT. If you read the message carefully, you will find that this is normal with large hard drives and will not prevent FIPS from working properly.

FIPS will then demonstrate how it plans to split the existing partition and you will have the opportunity to make changes. Do not just press enter. By default, FIPS will take all of the available free space for the new partition it creates, leaving your Windows partition with no free space at all. Windows will not run if it has no free drive space, so you must adjust the partitions. Use the up and down arrow keys to make large changes (ten cylinders at a time) and the left and right arrow keys for small adjustments (one cylinder at a time). The size of the existing partition is shown on the left and the size of your new empty partition is on the right. In the middle is the cylinder number where the split will take place. I left about 1500MB for my own Windows partition. Adjust yours according to your needs, but I would recommend using at least 1024MB for Windows.

When you are satisfied, press enter. FIPS displays information on the new partitions and asks permission to write it to disk. Your hard drive has not been altered at this point. You may choose to write this configuration to disk or re-edit the partition table. On my machine, when I chose to re-edit I received an error message that said FIPS couldn't find some files it needed. If this happens to you, just press ctrl-alt-delete to reboot from the floppy and start over. This did not cause me any trouble.

When you choose to write the new partitions, FIPS will offer to make a backup of your existing boot sector--you should definitely do this. The backup file it creates is only 1KB in size and will be invaluable if anything goes wrong.

After FIPS completes its work, it will display another message stating that you should run scandisk on your old partition. I found that Windows will sometimes miscalculate the used and free space on your drive after using FIPS, and Scandisk will correct this problem. If you choose to restore your original partition scheme using the RESTORRB utility, you should run Scandisk after this as well.

After FIPS was done, I received another error. This one said ``Memory Allocation Error, Unable to Load COMMAND.COM''. If you see this, just press ctrl-alt-delete to reboot and all is well. This should not affect your hard drive.

Finally, you may want to run the Windows FDISK program from your floppy. This is not necessary, since Linux has its own fdisk program for manipulating partitions. You will find that your hard drive now contains two ``Primary Partitions'' (or ``Primary DOS Partitions''). The second one was created by FIPS out of the free space on your drive. For Linux installation, delete this second partition, freeing up the space for allocating Linux partitions. (Be careful not to delete the first one, where Windows lives.)

Linux Install Tips for Large Drives

Once you've made room for Linux on your drive with FIPS, you should be able to install Linux by following the steps in the installation guide that accompanied your Linux distribution. Here are a few tips that should help you with the areas where dual booting might make a difference.

Planning your Partitions

Both the Red Hat and SuSE installation guides have excellent chapters on how to divide up your hard drive for use by Linux. Personally, I favor the ``Keep It Simple'' principle, especially for beginners. I let Windows keep the first partition, create a second for the entire Linux install, a third for Linux swap space and the fourth for my /home directory (where data is kept). Having /home on a separate partition will make things much easier, if you ever have to reinstall Linux. The size of each partition will depend on your individual situation, but this should suffice for most folks. However, if your hard drive is larger than 8GB, there is something else to think about--LILO.

Booting with LILO

The usual and recommended method to boot into Linux is using LILO (the LInux LOader). LILO can install itself in your boot sector and allows you to choose which operating system you would like at boot time. Due to a technical limitation, LILO is unable to read data from the hard drive past the 1024th cylinder--the 8GB mark for modern LBA (Logical Block Addressing) hard drives.

Does this mean you can't use the rest of your drive? Not at all. What it does mean is that your boot partitions must all live below the 8GB mark, that is, below cylinder 1024. Thus, if you want Windows to use the first 9GB of your fancy new 18GB drive, you won't be able to use LILO to boot Linux. Because of this limitation, Red Hat's Disk Druid tool for partitioning the hard drive will not allow you to create your Linux boot partition past cylinder 1024. You can still create the partitions using fdisk, but Red Hat setup will not install LILO if you do.

Booting from Floppy

It is possible to avoid the entire problem of the 8GB barrier by booting from a floppy disk. Although this may sound inefficient, it actually works quite well. The kernel loads into memory from the floppy disk and never accesses the floppy again, so loading the kernel is slower; but after that, the system runs the same as if it had booted from the hard drive. The Linux kernel has no difficulty accessing the end of large hard drives, so it can still reach all the files of your Linux installation.

The setup program for your distribution will almost certainly ask you to create a boot floppy during installation. Even if you don't plan to boot from floppy regularly, you should definitely make a boot disk. If for some reason LILO fails to install or becomes corrupted, you will have no other way to access the files on your Linux installation.

Booting with Loadlin

Loadlin is a program that runs under DOS (or Windows 95 in MSDOS mode). It can load the Linux kernel into memory from the DOS partition. Because it loads the Linux kernel from the hard drive, there is still a possibility the 8GB barrier could cause problems, but only if your Windows partition is larger than 8GB and is almost full. That's not likely at the time of this writing, but who knows--the next release of Windows might take up that much space by itself.

Frankly, I wouldn't recommend Loadlin to Linux novices because it can be difficult to configure correctly. If you simply must use it, an excellent Loadlin + Win95 Mini-HOWTO document available from the Linux Documentation Project should get you up and running.

Conclusion

Giving Linux a try does not mean you have to buy a whole new computer or even a new hard drive. With just a little extra effort, you can run both Linux and Windows without losing any data or any productivity while you learn Linux. I think you will find it is well worth the effort.


Resources

The FIPS home page: http://www.igd.fhg.de/~aschaefe/fips/

The Linux Documentation Project: http://sunsite.unc.edu/LDP/

The Loadlin + Win95 Mini-HOWTO: http://sunsite.unc.edu/LDP/HOWTO/mini/Loadlin+Win95.html

The Linux + Win 95 Mini-HOWTO: http://sunsite.unc.edu/LDP/HOWTO/mini/Linux+Win95.html

Moving from MS Windows to Linux: http://www.geocities.com/SiliconValley/Grid/2272/

Contact the author through his web site, http://www.control-escape.com.


Copyright © 1999, Vince Veselosky
Published in Issue 38 of Linux Gazette, March 1999


[ TABLE OF CONTENTS ] [ FRONT PAGE ]  Back  Next