Dual Boot Linux and Windows 2k

Intro, intermediate and advanced HOWTOs and discussion.
Post Reply
User avatar
weazy
Ex-Admin
Posts: 1688
Joined: Sun Jul 07, 2002 10:02 am
Location: any given
Contact:

Dual Boot Linux and Windows 2k

Post by weazy » Fri May 30, 2003 5:25 pm

Dual booting is a great way to get started learning Linux. It is also a great way to learn about some deeper issues of Windows. Another great thing about dual booting is that you can learn the intricacies of linux without abandoning your knowldge of Windows. This is a great way to proceed for newbies. Dual booting will allow you to run linux and windows on the same hard drive so that you can have the best of both worlds. Although Linux out-performs Windows on most fronts, we are all consumers and as such we enjoy having some things come easily and effortlessly. Also, Windows tends to have more game selections and better documentation for some software. That said, there is an alternative to dual booting. You can always run WINE or VMWare on your Linux machine. WINE lets you run Windows programs in Linux. VMWare creates another 'layer' in your Linux system and allows you to install any Windows OS within the VMWare program. It has all the functions of a normal Windows box, becuase it is a normal Windows box! You could also run Windows and use VMWare to install Linux within Windows.

This tutoral will assume you have weighed the pros and cons of WINE, VMWare and dual booting and have decided that dual booting is the best for you. I dual boot because when you are running Windows or Linux you get full system resources devoted to that OS whereas emulation programs are running one OS within another so you get much less performance from both when both are running. Of course, when VMWare is not running then the host OS runs normally. WINE has many other technical issues that I do not have time to work through. I can't run Linux exclusively because I work with folks that use Windows and we need to collaborate for development purposes. So dual booting it is.

During this tutorial I am using Windows 2000 SP1 and Slackware.

Step 1.
Load Windows 2000 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 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! NTLDR must reside in your MBR for my method to work properly. You can also replace NTLDR with LILO or another dual OS boot program, that is not covered here.

Step 2.
When Windows 2000 installs it writes to the master boot record (MBR) 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 boot. 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.

Step 3.
Install Linux. You can use any distro. 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 Windows 2000 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 nothing. The alternative is to install to the first sector of the Linux partition. I tend to do both. If you load LILO to the first sector of the patition then you can use a boot program to point to NTLDR and LILO and allow you to choose which you want to boot from. This is the method I use. Also, if something goes wrong in this setup then you have LILO on disk and you can always boot from a:\ and you will have Linux.

Step 4.
Quick Review: 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. Boot into Linux by placing your LILO boot disk into your floppy and booting to a:\. You will first need to get the boot sector onto a floppy, to do that you must mount the floppy disk. To mount the floppy drive in Linux type the following command “mount –t msdos /mnt/floppy”. It is likely that the floppy is already mounted since you did just boot from it. Insert a DOS formatted floppy so that we can copy the LILO boot sector file to it once the file is created. 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”






Step 5.
That should do it for the Linux part of this project. Remove the floppy and boot into Windows2000 normally. Go to “Windows Explorer” and copy the file, “linux.bin”, off the floppy to the root of your Windows2000 drive [c:\]. Next, open “boot.ini” file in “Notepad” and add the line c:\linux.bin=”Slackware (or whatever)” to the end of the file, save it and you are done.

Step 6.
Reboot without any floppies in the drive and 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!

Step 7. Oh Shit!
So things were going well but when you rebooted there was no OS option. Well, good thing we have a back-up plan. Assuming you followed all the instructions above, you now have a LILO boot disk. If worse comes to worse you can always set your boot sequence in BIOS to a:\ c:\ to check whether LILO is in your drive. If that is not good enough, and modifying boot.ini did not work for you but you did place LILO to the first sector of its partition, then there is one more option. You can use a boot manager. My favorite is XOSL, but there are many to choose from. Do a search for boot manager, download the one you like, read the documentation and go to town. You want to find one that will not make you do anymore partitioning. Boot managers scan your drive and find all your boot loaders, in this case LILO and NTLDR and then allow you to choose which to use at start-up. The boot manager you use is up to you. Good Luck.
--The Devil is in the Details--

Post Reply