Home Page
Linux Basics Debian Linux Installation Using Debian Packages Linux Modem Setup Setting Up A Network Setting Up DNS Servers Linux Internet Servers Linux LAN Servers Linux Database Server Linux Syslog Server Linux Fax Server Linux Web Cam Servers Linux Proxy/NAT Servers Linux Firewall Servers Linux Security Compiling Linux Programs Home Automation What Now?


Dual Booting Debian Linux and Windows


This page covers the use of LILO with Debian Sarge (2.2 kernel).
For a procedure that covers Grub with Debian Woody (2.4 kernel) click here.


WARNING:  Modifying the boot sector and partition table on a hard-drive is RISKY BUSINESS! Make sure you have a complete backup of your system, the original Windows CD, and the proper boot/recovery floppies before attempting to set up a dual-boot system. The commands given on this page worked for me. HOWEVER, that is no guarantee they will work for you or that you will make the correct selections. USE OF THIS PAGE IS AT YOUR OWN RISK.


Dual-Boot Overview Top of page

Setting up Debian Linux on its own dedicated system is the much preferred way to go, particularly when it comes to playing around with the networking functionality related to servers. Used Pentium-III clone systems can be gotten on auction sites like eBay for less than $100. However, if a separate system is not feasible or affordable, you can install Debian on your current system in a dual-boot configuration. Dual-boot is also useful if you wish to install Linux on a notebook to take advantage of all of the free network monitoring and testing tools available (bing, wireshark, mrtg, nmap, ntop, etc.).

When setting up a dual-boot system you can either have unpartitioned space on single hard-drive or a second unpartitioned hard-drive in the system. There are commercial and shareware utilities available that you can use to resize existing partitions. These would allow you to free up some space on an existing hard-drive that currently has a single Windows partition taking up the entire drive. Use of this type of utility is not covered here.

When you have two different OSs installed on a hard-drive, it's like having two different systems in one box. The trick is to be able to choose which OS you want to run when the machine boots up. This is where a "boot manager" comes in. It runs from the MBR (master boot record) of your hard-drive and allows you to select which partition you wish to boot. There are commercial and shareware boot managers available. In addition, Windows NT/2000/XP systems have a boot manager of their own (NTLDR) so no 3rd-party boot manager is needed.

Linux also comes with a boot manager called LILO (LInux LOader). If dual-booting a Windows 95/98/ME system you have no choice but to use LILO (or a 3rd party boot manager) because these versions of Windows don't have their own boot manager the way NT/2000/XP does. When you install Debian other bootable partitions are automatically detected and LILO is set up with a menu which allows you to select them at system boot. As you will see below, with Debian and NT/2000/XP you have a choice of whether you want to use NTLDR or LILO. We cover both scenarios below.

Assumptions

The procedures on this page assume the following:


Setting up dual-boot system is not a one-way deal. It takes a little work, but you can un-do it by removing LILO (or a 3rd-party boot manager) from the MBR by rewriting it. How you re-write an MBR differs from one version of Windows to the next. We cover a some of these scenarios in the Un-Doing Dual-Boot section below. Note that some Windows versions REQUIRE THAT YOU HAVE THE ORIGINAL CD to boot off of to re-write the MBR.

This page is divided into sections for 9x/ME and NT/2000/XP. In addition, the NT/2000/XP section has different procedures for using NTLDR and LILO as the boot manager (i.e. you can choose which boot manager you want to use).

NOTE that this page is not meant to be a stand-alone procedure. It is meant to provide the additional steps necessary to set up a dual-boot configuration. These additional steps need to be integrated with the appropriate steps given on the Debian Installation page.


Dual Booting Windows 9x/ME and Debian Top of page

We developed this procedure using Windows 98 with a FAT (16) partition but it shares the same boot structure as 95 and ME. Because the 9x/ME versions of Windows don't come with a boot manager utility, you'll have to use Linux LILO as your boot manager. (You could also use a 3rd-party boot manager at a later point.)

IMPORTANT:  You'll want to know whether your hard-drive is formatted as FAT or FAT32 (should you need to run FDISK later). To find out, open My Computer and right-click on the C: drive and select Properties. Note the "File system:" type.
Near the beginning of the Debian installation routine (after configuring the keyboard) the "Partition a Hard Disk" appears and selecting it runs the cfdisk utility which will prompt you to select a hard-drive. If you have only one hard-drive in the system only hda will be displayed. If you have two hard-drives installed, you'll be able to choose between hda and hdb. To install Debian on the second hard-drive, choose the hdb selection.

Once you select a hard-drive, the current partition information for that drive is displayed. On a second hard-drive, you should just have "free space". On a single hard-drive with unpartitioned space you'll see your existing Windows partition with "Boot" in the Flags column and a second "free space" partition entry.

Follow the instructions on the Installation page to create both "primary linux" and "primary linux swap" partitions in the "free space". When you're done, your cfdisk partition display should have entries similar to the following (the partition identifiers are indicative of a single-drive scenario):

hda1 Win95 FAT   (with "Boot" in the Flags column)
hda2 Linux
hda3 Linux swap

You can leave the Windows partition flagged as "Boot" as this makes it easier if you remove Linux later. Then resume following the installation instructions to "Write" and "Quit" cfdisk and install Debian into the new Linux partition.

Later in the Debian installation routine you'll use the:

Make System Bootable

selection which brings up a menu asking where you want to install LILO (in the MBR or the boot sector of the Debian partition). Select:

Install LILO in the MBR

A message will appear indicating that Linux "Discovered boot signatures on other partitions" at which time you'll want to select:

Include - Put all into menu

Then, at the next menu, select:

Reboot the system

and open CD drawer while the system is rebooting so it doesn't boot off of the CD. (You can leave the CD in the tray and close the tray once the system has begun booting off of the hard-drive.)

Once the LILO menu appears with selections for the Debian and Windows installations, select the Debian installation to boot into it to complete the installation setup per the Installation page.


Dual Booting Windows NT/2000/XP and Debian Top of page

We developed this procedure using Windows 2000 but NT and XP use the same boot manager program (NTLDR). You have two options when setting up a dual-boot system with NT/2000/XP. Because these versions of Windows have their own boot manager, you can use it or you can use Linux LILO. Regardless of the boot manager you use, the Debian installation starts out the same as that for 9x/ME.

Near the beginning of the Debian installation routine (after configuring the keyboard) the "Partition a Hard Disk" selection appears and selecting it runs the cfdisk utility which prompts you to select a hard-drive. If you have only one hard-drive in the system only hda will be displayed. If you have two hard-drives installed, you'll be able to choose between hda and hdb. To install Debian on the second hard-drive, choose the hdb selection.

Once you select a hard-drive, the current partition information for that drive is displayed. On a second hard-drive, you should just have "free space". On a single hard-drive with unpartitioned space you'll see your existing Windows partition with "Boot" in the Flags column and a second "free space" partition entry.

Follow the instructions on the Installation page to create both "primary linux" and "primary linux swap" partitions in the "free space". When you're done, your cfdisk partition display should have entries similar to the following (the partition identifiers are indicative of a single-drive scenario):

hda1 NTFS   (with "Boot" in the Flags column)
hda2 Linux
hda3 Linux swap

You can leave the Windows partition flagged as "Boot" as this makes it easier if you remove Linux later. Then resume following the installation instructions to "Write" and "Quit" cfdisk and install Debian into the new Linux partition.

Later in the Debian installation routine you'll use the:

Make System Bootable

selection which brings up a menu asking where you want to install LILO (in the MBR or the boot sector of the Debian partition). This is where the procedures differ depending on the boot manager you want to use.

Using LILO

If you want to use Linux LILO, the procedure is pretty much the same as it is for Windows 9x/ME. Select:

Install LILO in the MBR

A message will appear indicating that Linux "Discovered boot signatures on other partitions" at which time you'll want to select:

Include - Put all into menu

Then, at the next menu, select:

Reboot the system

and open CD drawer while the system is rebooting so it doesn't boot off of the CD. (You can leave the CD in the tray and close the tray once the system has begun booting off of the hard-drive.)

Once the LILO menu appears with selections for the Debian and Windows installations, select the Debian installation to boot into it to complete the installation setup per the Installation page.

Using NTLDR

The OS selections which NTLDR displays at boot-up (such as "Windows 2000 Professional") are contained in the BOOT.INI file. Both NTLDR and BOOT.INI are hidden system files located in the root of the C: drive. If you want to see them you need to change your Windows Explorer settings. Go into the View options and select "Show hidden files and folders" and un-check "Hide protected operation system files".)

If you want to use the NTLDR boot manager, the Linux boot configuration is a little different and you'll want to use a Windows utility called bootpart that will automate some of the setup for you. (You'll see how to use bootpart a little later.)

After pressing Enter at the "Make System Bootable" selection, you'll want to select:

Install LILO in the root partition's boot sector

A message will appear indicating that Linux "Discovered boot signatures on other partitions" at which time you'll want to select:

Ignore - Do not include any other partition

At this point a dialog box appears asking if you want to:

Install a master boot record on /dev/hda

BE SURE to answer NO to this. Then, at the next menu, select:

Reboot the system

and open CD drawer while the system is rebooting remove the Debian CD and your system will boot into Windows as if you haven't installed anything. That's because we haven't updated NTLDR to make it aware of the Linux partition. This is where the bootpart utility comes in.

Running bootpart

bootpart is stand-alone .EXE file. In other words, you don't have to "install" the utility. Just extract it (so you'll need an un-Zip utility installed) and put it on your Windows C: drive.

Create a folder on your C: drive called 'bootpart'

Download the compressed utility from:

www.winimage.com/bootpart.htm

and store it in the 'bootpart' folder. Once there, un-Zip the file into the same folder.

Open a DOS window and at the DOS prompt type in:

cd\bootpart

to go into the bootpart folder. Then at the DOS prompt type in:

bootpart

by itself to list the partitions. Note the number of your Linux root partition (type 83). It will most likely be a '1' because your Windows parition will be '0'.

Enter the following bootpart command (replacing the '1' with the appropriate number if necessary):

bootpart 1 bootsect.lnx Debian Linux

Now type in:

bootpart list

which basically just displays the selections that are contained in the BOOT.INI file and you should see the "Debian Linux" selection listed.

IMPORTANT:  Do NOT delete the bootpart folder on your Windows C: drive. It contains the "bootsect.lnx" file that NTLDR calls.
Now just reboot your system and "Debian Linux" should be listed with your Windows selection(s) on the boot menu. Select it and put the Debian No. 1 CD back in the drive and complete the installation setup per the Installation page.


Un-Doing Dual-Boot Top of page

If you hosed up something during the installation, you want to go back to square one and reinstall with a different dual-boot configuration, or you want to remove Linux from the system, you'll need to do three things:

  1. Make sure the Windows partition is set as the "Active" partition
  2. Delete the Linux Native and Linux Swap partitions from the hard-drive
  3. Re-write the MBR on your hard-drive using whatever repair utility is available with your version of Windows.

If you decided to use NTLDR when you set up an NT/2000/XP dual-boot system, we don't have to bother with step No. 3 because we never replaced the native NTLDR boot manager. You will however, want to edit the BOOT.INI file to remove the "Debian Linux" selection

Recall that during the Debian installation we said to leave the "Boot" flag set on the Windows partition. That takes care of No. 1 above.

Using FDISK on Windows 98

Recall also that we used Windows 98 to develop this page. However, from everything I've been able to find on the Web, the procedure would be very similar for 95 and ME. The steps to creating a 98 boot floppy are (for Windows 95 the procedure is the same except you'll be prompted to insert the Windows 95 CD when creating the floppy):


Boot the system off of the floppy (you won't need CD-ROM support) and just press Enter at the prompts for date and time.

At the A:\> prompt type in:

fdisk

It's at this point that you need to know if your hard-drive was formatted for FAT or FAT32. If it was formatted for FAT32, answer Yes to enabling "Large disk support". Otherwise enter No.

At the FDISK menu, select:

4 - Display partition information

You should see the three partitions listed (your Windows partition plus the two "Non-DOS" Linux partitions). You want to make sure that there's an "A" (Active) in the "Status" column for your Windows partition.

If the larger Non-DOS partition is active instead, press the Esc key to go back to the main FDISK menu and select:

2 - Set active partition

and enter the number of your Windows partition to make it active. You then want to press Esc several times until you're prompted to reboot the system, which you'll also want to do. You still want to boot the system using the 9x boot floppy however, and go back into FDISK.

That takes care of No. 1 of the three things we need to do. The next is to delete the Linux partitions.

At the FDISK main menu, select:

3 - Delete partition or Logical DOS Drive

and then select:

4 - Delete Non-DOS partition

CAUTION - Even though you selected to delete a Non-DOS partition, FDISK still defaults to delete partition No. 1 which is likely the PRI DOS (your Windows) partition. Be sure to delete only the Non-DOS partitions (most likely partitions 2 and 3).

After you have deleted both Non-DOS partitions, press Esc several times until you're prompted to reboot the system, which you'll also want to do so the system is using the updated partition table. You still want to boot the system using the 9x boot floppy, but DON'T go back into FDISK.

That takes care of No. 2 of the three things we need to do. The next is to rewrite the MBR.

At the A:\> prompt type in:

fdisk /mbr

This will rewrite the MBR to what's normal for Windows. That's it! You've done all three things and your system is back to it's non-dual-boot configuration. Now just remove the floppy and reboot your system.

Using Windows 2000

Recall that we used Windows 2000 to develop this page. The procedures for NT and XP will likely similar.

You can accomplish the first two steps of the three we need to complete from within Windows 2000 like so:


If you decided to keep using NTLDR for a boot manager, all that's left to do at this point is open the BOOT.INI file (located in the root of the C: drive) with Notepad and remove the following menu selection line for Debian Linux (you may want to check the properties of the file first to make sure it's not flagged "Read-only" and uncheck that box if it is):

C:\bootpart\bootsect.lnx="Debian Linux"

If you used LILO for a boot manager we need to re-write the MBR. For Windows 2000 you need to do the following:


It took some doing but that took care of the third step so everything should be back to the way it was before you installed Linux and configured your system for dual-boot.

Using Windows NT

This section will be added when time allows. You should be able to use NT's "Disk Administrator" (under Administrative Tools) to check/set the Windows partition as active and delete the Linux partitions. Just be sure to use the "Commit changes now" menu selection after making any changes.

Re-writing the MBR on an NT system is a little more involved.





Did you find this page helpful ?
If so, please help keep this site operating
by using our DVD or book pages.



Site, content, documents, original images   Copyright © 2003-2016   Keith Parkansky   All rights reserved
Duplication of any portion of this site or the material contained herein without
the express written consent of Keith Parkansky, USA is strictly prohibited.

This site is in no way affiliated with the Debian Project, the debian.org Web site, or
Software In The Public Interest, Inc. No endorsement of this site by the Debian Project
or Software In the Public Interest is expressed or implied. Debian and the Debian logo
are registered trademarks of Software In The Public Interest, Inc. Linux is a registered
trademark of Linus Torvalds. The Tux penguin graphic is the creation of Larry Ewing.

LIABILITY

IN NO EVENT WILL KEITH PARKANSKY OR BLUEHOST INCORPORATED OR ANY OF ITS SUBSIDIARIES BE LIABLE TO ANY PARTY (i) FOR ANY DIRECT, INDIRECT, SPECIAL, PUNITIVE OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF PROGRAMS OR INFORMATION, AND THE LIKE), OR ANY OTHER DAMAGES ARISING IN ANY WAY OUT OF THE AVAILABILITY, USE, RELIANCE ON, OR INABILITY TO USE THE INFORMATION, METHODS, HTML OR COMPUTER CODE, OR "KNOWLEDGE" PROVIDED ON OR THROUGH THIS WEBSITE, COMMONLY REFERRED TO AS THE "ABOUT DEBIAN" WEBSITE, OR ANY OF ITS ASSOCIATED DOCUMENTS, DIAGRAMS, IMAGES, REPRODUCTIONS, COMPUTER EXECUTED CODE, OR ELECTRONICALLY STORED OR TRANSMITTED FILES OR GENERATED COMMUNICATIONS OR DATA EVEN IF KEITH PARKANSKY OR BLUEHOST INCORPORATED OR ANY OF ITS SUBSIDIARIES SHALL HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, AND REGARDLESS OF THE FORM OF ACTION, WHETHER IN CONTRACT, TORT, OR OTHERWISE; OR (ii) FOR ANY CLAIM ATTRIBUTABLE TO ERRORS, OMISSIONS, OR OTHER INACCURACIES IN, OR DESTRUCTIVE PROPERTIES OF ANY INFORMATION, METHODS, HTML OR COMPUTER CODE, OR "KNOWLEDGE" PROVIDED ON OR THROUGH THIS WEBSITE, COMMONLY REFERRED TO AS THE "ABOUT DEBIAN" WEBSITE, OR ANY OF ITS ASSOCIATED DOCUMENTS, DIAGRAMS, IMAGES, REPRODUCTIONS, COMPUTER EXECUTED CODE, OR ELECTRONICALLY STORED, TRANSMITTED, OR GENERATED FILES, COMMUNICATIONS, OR DATA. ALL INFORMATION, METHODS, HTML OR COMPUTER CODE IS PROVIDED STRICTLY "AS IS" WITH NO GUARANTY OF ACCURACY AND/OR COMPLETENESS. USE OF THIS SITE CONSTITUTES ACCEPTANCE OF ALL STATED TERMS AND CONDITIONS.