How To Dual boot Windows and Linux|
If you’re like me, you dabble in just about everything from software/hardware to operating systems. When it comes to operating systems, nothing is better than having one PC with multiple operating systems to boot into. I’ve been dual booting MS Windows9x and Linux since I first discovered Linux 4 years ago. Now that Microsoft has released it’s newest business desktop OS, Windows2000 Pro, I have embraced it as my OS of choice, but was immediately confounded by a serious problem, Linux does not recognize NTFS partitions as bootable under normal installation. After searching and researching all over the Internet, I finally came across some directions and through trial and error developed my own strategy to dual boot Windows2000 Pro and Linux. Having heard many individuals ask me how I did it, I feel compelled to put it in writing, so all may share in the goodness of dual booting.
For this article, I’ve used a retail version of Windows2000 Pro with SP1 and a downloaded copy of Mandrake 7.1 with the “Extension” CD. You can find a site to download Mandrake from at Mandrake's mirror page. Although Mandrake is not the only distribution available, I’ve found it to be one of the very best. It comes with built in support for my HPT366 ATA66 controller on my Abit BP6 motherboard and since I will use that drive under Linux, things will go smoother. Mandrake also has the best installation known to mankind and for beginners this is indispensable. Another aspect of Mandrake that is key is its compatibility with most Red Hat RPMs. And finally, Mandrake comes loaded with all the major graphical desktops, so you can try out each one and see which works best for you! Ok, enough butt kissing of Mandrake! I have, as stated earlier, an Abit BP6 motherboard, running dual 433Mhz Celerons OC’ed to 488Mhz, 320MB of PC100 SDRAM, and a Maxtor 30GB 7200rpm ATA66 hard drive. My video card is an eVGA GeForce256 SDR, I know I should get a real GeForce card, but hey, I’m married with 2 kids! The rest of the system is pretty standard so I won’t go into it.
The Preliminary Steps
Load Windows2000 Pro, preferably on the first partition of the drive, if you are using the same drive for both operating systems. If you plan on using 2 hard drives, then put Windows2000 Pro on the primary drive. You need to have the Windows boot sector on the drive that will be looked at first by the BIOS when you turn on the PC. As long as that requirement is met I don’t really care where you load Linux to, so long as you know!
Windows2000 Boot Procedure
I’m not an expert on WindowsNT/2000 by any stretch of the imagination, but I can say that when Windows2000 Pro installs it writes to the master boot record which then points to a file on the root of the system (the C drive in this instance) called “boot.ini”. The “boot.ini” file points to the location of the files necessary to start the OS loading. If you are familiar with Linux and LILO (the LInux LOader) you’ll have an idea of what the “boot.ini” file does, because it acts a little bit like the “lilo.conf” file. Anyways, the “boot.ini” file is what we will be modifying so the windows boot loader knows there is another OS for booting, for now just find it. If you are unable to see it, then you may have “hide system files” turned on.
Open an Explorer window, go to the Tools pull down menu and select Folder Options and then the View tab. There you should see radio buttons to Show hidden files and folders, check it, and uncheck Hide protected operating system files (Recommended), hit OK at the bottom and you should now be able to see boot.ini in the root directory.
Most Important Step During The Linux Install
Ok, you're waist deep in the Linux install, cruising along nicely, the next step is VERY IMPORTANT. You must create a boot disk when the Linux install asks, because we will need to make the boot sector that LILO creates into a file so that the Windows2000 Pro boot loader can use it to start Linux. And since we are not installing LILO to the MBR (Master Boot Record for those who don’t know), you'll have no way of getting Linux to boot and the long setup process will be for naught! .
The "boot disk creation" step in Mandrake’s install process is right before the LILO install, but after the package install, so watch for it and DO NOT skip it!
As I’ve said before, there are many distributions of Linux to choose from and of the half dozen or so that I’ve had the pleasure of installing all of them have a step where you can configure and install a boot loader. With the newer distributions GRUB is offered as well as LILO. GRUB is another boot loader that I’ve found to be particularly nice, but I’m not familiar enough with GRUB to include it here, so we’ll stick to LILO. When you get to the step in setting up LILO you have two choices, install it now or skip the step entirely.
Going ahead With LILO
If you choose to install LILO while installing Linux, make ABSOLUTELY sure you install it to the partition that Linux is installed on. Example: You have Windows2000 Pro installed on the primary drive of the primary controller and are installing Linux on a second partition on the same drive. Linux will set partition one of the drive as hda1. Linux assigns hda to the primary drive of the primary IDE controller, hdb to the secondary drive so forth and so on. If you have an ATA66 controller as well as an ATA33 (aka slow ass) controller on your system Linux will likely call the ATA66 drive hde since hda, hdb, hdc and hdd are reserved for the primary/secondary ATA33 controllers and their repsective drives. If SCSI is your thing, Linux uses sd? as the SCSI drive designator with a letter just like the IDE drives. The numbers that follow the drive designators represent the different partitions on the given drive. Now, we have Windows2000 Pro installed on hda1 and during your Linux setup you had to create at least 2 partitions, a main partition and a swap partition, hda5 and hda6 respectively.
If you use the auto partition function as found in Mandrake’s install process you might end up with 3 partitions with one of the partitions being the boot partition and mounted as “/boot”. This “/boot” partition is where you should install LILO. If you decided to create your own partitions and didn’t setup a “/boot” partition but just a main “root” partition, which is fine, then install LILO to it. Either way, you must remember what the drive designator and partition number was for the partition you are going to install LILO to.
When the LILO setup begins it will ask where you wish to install it and this is where a few brain cells will come in handy as well as the picture above. Instead of putting it on the MBR of the drive, which in our case is hda, choose to install LILO on the partition I asked you to remember, hda5 for us. Some of you might be asking yourself “why go through all this trouble if I can just boot from a floppy”. Shut up you wussy boy and grow some balls, besides booting from a floppy is slow and we want speed, lots of it to be precise!
Life Without LILO
If you don’t feel confident enough or are to much of a wimp to go through setting up LILO in the install process, then you can choose not to, but remember MAKE A BOOT DISK! You will be able to install LILO once you get into Linux and yes we will need to install LILO. Now, you have Linux installed and you have a Linux boot disk, go ahead and boot into Linux. If you have opted for a graphical logon, then open a “terminal” window so you can type commands at the command line. Remember, you must be root to run the following commands so either login as “root” or SU to “root”.
I used “vi” to edit the “lilo.conf” file and on Mandrake the file is located in the “/etc” directory but different distributions my have it in other places. The following picture is a line-by-line view of what our “lilo.conf” file looks like. If you have installed LILO during the Linux install process this is a good way to check and make sure it was installed correctly! Pay special attention to the line “boot=”, it must have the partition we installed Linux listed, NOT the partition where Windows2000 Pro is installed. In this instance we are using “/dev/hda5”!
Yours should look similar but remember, if you have Linux installed on a different drive, the drive designator and partition number may be different. Just stir up that gray matter between your ears and you should be able to figure it out, if not get up from the computer and step away! Once you have completed the modifications required for your specific system, save the file. Installing LILO is simple, after "lilo.conf" is saved just type at the command prompt “/sbin/lilo” minus the quotes of course! If you need here’s a picture.
Getting The Boot Sector To Windows2000 Pro
Let’s review real quickly, Windows2000 Pro is installed, Linux is installed and LILO is installed! Our next step is to extract the Linux boot sector and get it to Windows. I find it easiest to just copy the boot sector to a floppy disk, boot into Windows and copy it off the floppy. To mount the floppy drive in Linux type the following command “mount –t msdos /dev/fd0 /mnt/floppy” or as seen in the picture below.
It is very likely that the floppy is already mounted since you did just boot from the darn thing...duh! Insert a DOS formatted floppy so that we can copy the LILO boot sector file to it once the file is created. Note, Mandrake mounts the floppy to the “/mnt/floppy” directory, other distributions may mount it elsewhere!
I’ll Give You A Boot
The following command will copy the LILO boot sector to a file that is 512 bytes big, right to the floppy and called “linux.bin”! Don’t forget to put a DOS formatted floppy in the drive!
“dd if=/dev/hda5 bs=512 count=1 of=/mnt/floppy/linux.bin”
Here’s a picture for your convenience.
That should do it for the Linux part of this little project. Remove the floppy and boot into Windows2000 Pro normally. Go to “Windows Explorer” and copy the file, “linux.bin”, off the floppy to the root of your Windows2000 Pro drive. Next, open “boot.ini” file in “Notepad” and add the line "c:linux.bin=”Mandrake 7.1” to the end of the file, save it and you are done. Below is a pic of what my "boot.ini" file looks like.
I’ll Give You A Boot
Reboot without any floppies in the drive and viola you should be able to choose which OS you want to boot into! If you have gone and turned off the display of other operating systems, you will need to turn that back on. If you don’t know how or don't remember, right click on “My Computer”, click on “Properties”. This brings up the “System Properties” window, click on the “Advanced” tab and then the “Startup and Recovery” button at the bottom. You should see the first check box unchecked, simply put a check in the box and then set the number of seconds the display is up before booting into the default OS!
I sincerely hope this article has helped you in dual booting Windows2000 Pro and Linux, I wish I could have covered every possible contingency, but that would have made too long of an article. You might run into problems not covered here and we'll be happy to give assistance, just drop a post in this thread and we'll do our best. With so many different distributions available, problems will arise, but if you activate the blob on your shoulders I’m sure you will be able to figure it out. Happy dual booting from the LittleWhiteDog team!
If you have questions please read my Aftermath article where I tried to answer some of the more common questions asked of me by the faithful LWDers
Copyright © by LWD All Rights Reserved.
Published on: 2004-02-22 (370010 reads)[ Go Back ]