Putting Linux and Windows on the Same Machine

What if you have only one computer, and you want to be able to run Linux as well as Windows? Well, you can -- through something called dual booting. Dual booting is an either/or proposition. You can't really run Windows and Linux at the same time. This month's column will be of most use to Windows 3.x/95/98 users. If you're running NT, you should purchase the commercial product,

What if you have only one computer, and you want to be able to run Linux as well
as Windows? Well, you can — through something called dual booting. Dual booting is an either/or
proposition. You can’t really run Windows and Linux at the same time. This month’s column will be of most
use to Windows 3.x/95/98 users. If you’re running NT, you should purchase the commercial product,

When you start up a computer with Linux installed, you get the prompt, LILO:. If you do
nothing, press the “enter” key or type linux then Linux will start up. If you have a dual boot
computer, you can type the name of another operating system (like Windows) at this point and start that OS
instead of Linux. It’s pretty easy to install Linux to dual boot on a machine that’s already running Windows,
but it’s not so easy to add Windows to a machine that’s running Linux. I would not recommend trying
this unless you absolutely have to.

If you already have Windows installed, there are a few common scenarios for those looking to create
dual boot machines:

1. You have one disk drive with one “partition.” In other words, you have a single disk and you see only
drive “C:” from “Windows Explorer” or “My Computer”.

2. You have one disk with two or more partitions. You can see drives “C:” and “D:”, even though you
have only one hard drive (Figure 1). These are called “logical” drives.

Newbies Screen MyCompNT 1
Figure 1: “My Computer” shows partitions C: and D:, which are on the same
hard drive.

3. You have two or more disks with one or more partitions on each (Figure 2).

If you have more than one disk then you may choose to dedicate one drive to Windows and another to
Linux. Simply go ahead and install Linux. When it comes time to “partition” and “mount” your disks then just
leave the Windows drive alone. Don’t edit its partitions and don’t mount it.

But if you have only one disk then keep reading, you’ll need to do some work on the disk to get it

On the computer shown in Figure 2 I have two partitions, one on each drive. I decided to use the
second drive entirely for Linux, and to break up the first drive into two partitions. I don’t use Windows
much and so I didn’t give it much more space on the disk than it was already using. Instead, I devoted most
of the space on that drive to Linux.

Newbies Screen DevMgr95 2
Figure 2: Two disk drive system.

Partitioning Revisited

We talked about disk partitioning in this column in the Spring 1999 issue. Think of the disk like the junk
drawer you have in your kitchen. The drawer is much more manageable if you buy one of those plastic
drawer organizers with lots of compartments. Imagine that your organizer has movable compartment walls
so that the compartments are re-sizable. Once you start filling the compartments then it becomes difficult
to resize them without removing everything — the clutter inside just gets in the way. Repartitioning a
drive is a little like this.

There isn’t much on my disk drive #2 (D:), so I can just copy its contents to drive #1 (C:) leaving it
completely free for Linux. Drive C: is more of a problem. It has just one big partition, and I now want to add
a second. I need to move all of my Windows data to one part of the disk and create a new Linux partition in
the unused part.

The usual way to do this is by copying everything off of the disk, reformatting it (which erases
everything on the disk), creating new partitions, and then re-installing windows and copying back all of the
data. But I don’t want to re-install Windows and copy all of my data twice. Lucky for me, there’s a way
around this. It goes by the name of fips.

Making Room on Your Drive with fips

As I’ve explained in months past, Linux, unlike Windows, requires that you create more than one
partition on your hard drive. Be aware of this, but don’t make it a big concern right now — at this point
we’re only talking about making Windows and non-Windows partitions. We can give Linux one large partition
and later break it into the different partitions that Linux requires.

fips is a freely-available DOS utility that comes with some Linux distributions (Red Hat, for
example — in the dosutils directory). If you don’t have it in your particular distribution, you can
find it at the Red Hat FTP site (ftp.redhat.com). There’s another program in the same place named
restorrb.exe. If anything should go wrong when you repartition, restorrb may
be able to undo the changes.

Preparing for fips

You use fips to change the size of an existing partition, and to create new partitions in the
extra space on your disk. Before you can run fips, you’ll need to follow these steps.

* Back up important data on the disk. fips is pretty reliable, but we’re manipulating the disk
at the most basic levels and a simple mistake could destroy your data.

* Delete any files that you don’t want, and empty your “recycle bin”. In other words, clean up your

* Defragment your disk. If you’re currently running Windows then you can do this by going to the
“Start” menu and choosing Programs-> Accessories-> System Tools-> Disk

* Run ScanDisk (it’s in the same System Tools folder as “Disk Defragmenter”) and let it fix any errors
on your disk.

* Disk Defragmenter rearranges the data on your disk so that the used areas are next to each other and
so there’s one big empty space instead of lots of small empty spaces. Essentially it moves all of the data to
one part of your disk. As with the junk drawer we’ve first thrown out the bits of string and tin foil — the
stuff we don’t really need — and then squeezed everything remaining toward the front of the drawer,
leaving as much room behind as possible.

Since I don’t intend to use Windows for much I really want to allocate as much of the drive to Linux as I
can. Once you compact your drive, fips can tell you exactly how much room Windows is using. It
will allow you to make your Linux partition butt right up against the end of the Windows partition if you

At this point you should note how much room is available on the disk (there’s another utility in the same
folder called Drive Space that will tell you this). You want to make the Windows partition smaller, but you
also want to leave some extra room, depending on how many applications and how much data you plan to add
to Windows. On my 325MB disk, Windows was taking about 100 MB. I barely use Windows, so I made the
Windows partition 150 MB. I needed enough room on the Windows partition for Windows to run, plus some
swap space and some room for the registry to grow, and for my applications to run. I may want to create
some small documents, for example. I created a 175 MB Linux partition on this drive. I also made all of the
second drive a Linux partition. If you have only one drive and you’re making a new partition for Linux, make
sure that there’s at least 300 MB left for you to actually install Linux. If not, then you may have to delete
more files (and defragment again).

Once this is done, follow these simple steps:

* Make a DOS boot floppy disk. You can do this from the Control Panel (Add/Remove
Programs->Startup Disk). You can also do it from a command prompt, or the Run menu. With an
empty floppy in the drive, type the command format /s a: (assuming your floppy is in drive A).
If you’re running NT then you’ll have to find some other way to make the boot floppy.

* Copy the fips.exe and restorrb.exe from the Red Hat CD-ROM
(\dosutils directory) onto the floppy disk.

If you have the Red Hat CD, in \dosutils\fips_20 there’s a Microsoft Word file named
fips.doc. This is documentation for the program. It is a little bit technical, but is really worth

Running fips

Shut down Windows and boot from the floppy you created. Start fips at the DOS prompt by
typing fips and then pressing “enter.” fips will now start up and print some
introductory information. Press any key to proceed. If you have more than one disk drive, fips
will ask you which one you want to repartition. Select your drive.

fips will display the partition information for your disk. Don’t worry if it doesn’t make sense
to you. fips will check for errors, and if you have more than one partition, it will ask you which
one you want to split. Go ahead and select the partition.

fips will then display some information from the “boot sector” of your disk. Again, don’t
worry if this doesn’t make sense, for the most part fips is simply checking for errors on the
disk. If you’ve run “ScanDisk” successfully then there shouldn’t be any. fips will ask you Do
you want to make a backup copy of your root and boot sector?
Press y. This will save the
information that restorrb needs in case you have to use it later.

Next you’ll be asked Do you have a bootable floppy in drive A?. Make sure the DOS boot
floppy you made earlier is there and press y.

The next prompt is unusual and important. It is where you can select the new partition size. Remember
that we have moved everything on the disk toward the “front”. We’re going to take the “wall” that is the
end of the partition and move it forward, with the new partition behind it. This display shows you three
columns: Old Partition, Cylinder, and New Partition.

Ignore the Cylinder column. The Old Partition column shows you the size (in
megabytes) of the existing (old) partition, and the New Partition column shows the size (in
megabytes) of the new partition. From the numbers below those headings you can see that fips
figured out exactly “how far back from the front” your data exists, and it will let you make the old
partition just that big. The new partition begins immediately after and extends to the end of the disk.

You can use the arrow keys to move the partition boundary back and forth. Note that the effect of this
is to make Old smaller and New bigger, or vice versa. The total of those two numbers
stays the same. Notice too that you can’t make Old any smaller than it started out.
fips already figured out how much space your data is taking, and that’s as small as you can make
the old partition.

Use the arrow keys to select the partition sizes that you desire, and press “enter” when you’re
satisfied. Remember to give Windows some free space on the disk, otherwise it won’t run.

fips will check the new partition table, and if it makes sense then it will ask you Do you
want to continue or re-edit the partition table (c/r)?
. When you’ve got the partitions set the way that
you want them then press c to continue.

fips will finish its calculations, then show you the boot sector again, and finally ask you if
you are Ready to write the new partition scheme to disk. Press y and fips
will write the changes and then exit.

When I completed fips I got the error Unable to load COMMAND. COM. This is a
fairly common error. If you get it, don’t panic. Just press ctrl-alt-delete to reboot. It’s important that you
do not write anything to the disk after running fips and before rebooting your system.

After you’ve rebooted then you can run the chkdsk command in DOS to verify the partition
you just shrunk. If everything looks okay then you can remove the boot floppy and boot again into

After fips

Once you’ve finished with fips you should have your original C: partition, now reduced in
size. You should also have another partition which DOS (and Windows) may not see. Go ahead and install
Linux on this machine. When you come to the “Disk Druid” setup screen, be sure to not modify (Edit or
Delete) the DOS partition, and do not specify a mount point for it. Use the remaining partitions to install
Linux using the guidelines we’ve discussed in the last few months.

When the Linux installation is complete, reboot your machine. At the LILO: prompt press
either “Tab” or ?, and you should get a list of the operating systems that LILO has found. Start
the operating system that you want by typing the name that LILO shows you.

One interesting feature of this dual boot is that, although Windows can’t understand Linux files, Linux
can understand DOS files. On my dual boot Windows95/Linux computer, when Linux is running I can type
mount /dev/hda1/mnt, where hda1 is the name that Linux uses for my DOS partition
(I remembered it from the “Disk Druid” setup screen).

When I mount the partition in this way then the directory /mnt becomes the DOS partition of
my disk. We’ll discuss in coming months some of the things that you can do with this. Remember that you
don’t want to set this mount point for the DOS partition during the Linux installation, since you want this to
remain a pure DOS partition.

Chances are that over time as you become more accustomed to Linux and find how friendly and useful it
is, you’ll find yourself using it more and more, and Windows less and less. In the meantime, Windows is still
there for you for your existing applications and data.

Hal Moroff has been developing UNIX systems and applications for 20+ years. He’s new enough to Linux
that he’s finding new things every day. He can be reached at halm@ieee.org.

Comments are closed.