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 Grub with Debian Sarge/Etch/Lenny (2.4/2.6 kernels).
For a procedure that covers LILO with Debian Woody (2.2 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 Pro systems have a boot manager of their own (NTLDR) so no 3rd-party boot manager is needed.

Linux also comes with boot managers called LILO and Grub. If dual-booting a Windows 95/98/ME system you have no choice but to use LILO or Grub (or a 3rd party boot manager) because these versions of Windows don't have their own boot manager the way NT/2000/XP Pro do. When you install Debian other bootable partitions are automatically detected and Grub 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 Pro you have a choice of whether you want to use NTLDR or Grub. 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 Grub (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 Pro. In addition, the NT/2000/XP Pro section has different procedures for using NTLDR and Grub 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 (since we don't have any experience with XP Home we can't say for sure, but assume it's the same as 95/98/ME). Because the 9x/ME versions of Windows don't come with a boot manager utility, you'll have to use Grub 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.
Run the Debian installation routine as detailed on the Installation page up to Step 4 and you'll see the "Partitioning disks" screen. Seletct the Manually edit partition table partitioning method and press Enter.

On the partition list screen arrow down to the line that contains the words "FREE SPACE" (which will be unpartitioned space on your primary (IDE1) drive or a partitionless second (IDE2) drive) and press Enter. (If you don't have a line with the words "FREE SPACE" it means the space you plan to use for Debian is already partitioned. You'll have to delete this partition (DON'T DELETE THE WRONG ONE!) so a Linux partition can be created.)

On the "How to use this free space" screen select Automatically partition the free space and press Enter. (This will create both the root and swap partitions.)

When asked for a partitioning scheme use the default All files in one partition scheme by pressing Enter. On the next screen you should see that you have a "#1 Primary" partition formatted as FAT which will be your Windows partition, a "#2 Primary" partition which is the root partition for your Debian installation, and a logical swap partition (#5).

Arrow down to Finish partitioning and write changes to disk selection and press Enter and answer Yes at the confirmation screen.

The partitions will be created and the base packages will be installed. Then you will be asked if you want to "Install the GRUB boot loader to the master boot record". Answer Yes to this.

The first part of the Debian installation will complete and you'll be prompted to remove the CD and Continue to reboot the system. At this point you can return to Step 5 of the Debian installation routine on the Installation page.

Grub will load Debian by default. Your Windows 9x/ME OS will be the third Grub menu selection (behind Debian and Debian Recovery). If you want to change this to default to your Windows installation, you'll need to edit the file:

/boot/grub/menu.lst

(You can use the nano editor to open this file.) Look for the line:

Default       0

and change the 0 to a 3. You can also change the timeout value at the same time, which is the value the Grub menu stays on the screen before it boots the default OS.


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 Grub. Regardless of the boot manager you use, the Debian installation starts out the same as that for 9x/ME.

Run the Debian installation routine as detailed on the Installation page up to Step 4 and you'll see the "Partitioning disks" screen. Select the Manually edit partition table partitioning method and press Enter.

Single Hard-Drive Setup

On the partition list screen arrow down to the line that contains the words "FREE SPACE" which will be unpartitioned space on your primary (IDE1) drive (which also contains the Windows partition) and press Enter.

On the "How to use this free space" screen select Automatically partition the free space and press Enter. (This will create both the root and swap partitions.)

When asked for a partitioning scheme use the default All files in one partition scheme by pressing Enter.

Back on the partition list screen you should see that you have a "#1 Primary" partition formatted as FAT or NTFS which will be your Windows partition, a "#2 Primary" partition which is the root partition for your Debian installation, and a logical swap partition (#5).

If you plan on using NTLDR arrow the highlight bar to the #1 Primary partition (your Windows partition) and press Enter. Look at the Bootable flag setting. If it's not set to on, press Enter to change it to on.

Select Done setting up the partition and press Enter to return to the parition list screen.

Arrow down to Finish partitioning and write changes to disk selection and press Enter and answer Yes at the confirmation screen.


Two Hard-Drive Setup

On the partition list screen arrow down to the line under IDE2 that contains the words "FREE SPACE" which will be unpartitioned second hard-drive and press Enter.

On the "How to use this free space" screen select Automatically partition the free space and press Enter. (This will create both the root and swap partitions.)

When asked for a partitioning scheme use the default All files in one partition scheme by pressing Enter.

Back on the partition list screen you should see that you have a "#1 Primary" partition under IDE1 formatted as FAT or NTFS which will be your Windows partition and a "#1 Primary" partition under IDE2 which is the root partition for your Debian installation. You'll also have a logical swap partition (#5) under IDE2.

If you plan on using NTLDR arrow the highlight bar to the #1 Primary partition under IDE2 (your Debian root partition) and press Enter. Look at the Bootable flag setting. If it is set to on, press Enter to change it to off.

Select Done setting up the partition and press Enter to return to the parition list screen.

Look at the IDE2 line in the parition list. In the same line is the hard-drive designation. It will either be hdb, hdc, or hdd. Write down what it is as you will need it later.

Arrow down to Finish partitioning and write changes to disk selection and press Enter and answer Yes at the confirmation screen.


The partitions will be created and the base packages will be installed. Then you will be asked if you want to "Install the GRUB boot loader to the master boot record".

To Use Grub

If you want to use Grub, simply answer Yes to installing it in the master boot record.

The first part of the Debian installation will complete and you'll be prompted to remove the CD and Continue to reboot the system. At this point you can return to Step 5 of the Debian installation routine on the Installation page.

To Use 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 because Windows can't access Linux partitions. 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.)

If you want to use NTLDR, simply answer No to installing Grub in the master boot record.

You will then be asked where you want to install Grub. You basically want to install it in the Debian root partition. If you installed Debian in the second partition of your one and only hard-drive, enter /dev/hda2.

If you installed it on a second hard-drive, look at the hard-drive designation that you wrote down earlier in this procedure. You'll want to enter /dev/hdx1 so that x matches the 'b', 'c', or 'd' in the hard-drive designation you wrote down.

The first part of the Debian installation will complete and you'll be prompted to remove the CD and Continue to reboot the system.

HOWEVER, you cannot continue with the second part of the Debian installation at this point because you won't be able to boot into your Debian partition. Complete the next section to install bootpart.

Running bootpart

bootpart is stand-alone DOS/Windows .EXE file that your run after your Debian installation is complete and you want to use the NTLDR boot loader. 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 return to Step 5 of the Debian installation routine on 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.






Tell a friend about this site Tell a friend about this site.

Site, content, documents, original images   Copyright © 2003-2013   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.