|
|
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
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 systems can be gotten on auction sites like eBay for less than $50. 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 open source 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 open source boot managers available. In addition, WindowsNT/2000/XP Pro systems have a boot manager of their own (NTLDR) so no 3rd-party boot manager is needed.
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 andNT/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:
- You have a working installation of Windows on the system you wish to set up for dual-boot.
- You have either a second, partition-less hard-drive installed in your system or you have unpartitioned space on the hard-drive which contains your Windows installation.
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.
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 2000/XP and Debian
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.
Run the Debian installation routine as detailed on the Installation page up toStep 6 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 (SCSI1) 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 SCSI2 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 SCSI1 formatted as FAT or NTFS which will be your Windows partition and a "#1 Primary" partition under SCSI2 which is the root partition for your Debian installation. You'll also have a logical swap partition (#5) under SCSI2.
If you plan on using NTLDR arrow the highlight bar to the #1 Primary partition under SCSI2 (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 SCSI2 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 check "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 the first part of 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 command prompt and at the command prompt type in:
cd\bootpart
to go into the bootpart folder. Then at the command 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.
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 DebianIMPORTANT: Do NOT delete the bootpart folder on your Windows C: drive. It contains the "bootsect.lnx" file that NTLDR calls.No. 1 DVD back in the drive and return to Step 5 of the Debian installation routine on the Installation page.
Un-Doing Dual-Boot
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:
- Make sure the Windows partition is set as the "Active" partition
- Delete the Linux Native and Linux Swap partitions from the hard-drive
- 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 earlier we said to leave the "Boot" flag set on the Windows partition. That takes care ofNo. 1 above.
Using Windows 2000
Recall that we used Windows 2000 to develop this page. The procedures for XP will likely be similar.
You can accomplish the first two steps of the three we need to complete from within Windows 2000 like so:
- Right-click on "My Computer" and select Manage
- Under "Storage" click once on Disk Management
- On the partition display on the right side, right-click on your Windows partition (the one with the "C:" drive designation) and verify that "Mark Partition Active" is greyed out (indicating that it already is active). If it's not greyed out, select it to make your Windows partition active.
- Right-click on the two Linux partitions (the two partitions with no drive letters) and select Delete partition.
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:
- Boot off of the Windows 2000 CD.
- At the "Welcome to setup" screen press R to repair a Windows 2000 installation.
- At the "Repair Options" screen press C to run the recovery console.
- Enter the number for the Windows installation to repair (most likely "1").
- Enter the administrator password for that installation
- At the C:\WINNT prompt, type in:
fixmbr
and press Enter and answer Y when prompted for confirmation.- Back at the C:\WINNT prompt, type in:
exit
to reboot the system and remove the CD.
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.
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.