Tuesday, August 23, 2005

Setting up Windows (XP or NT) & Linux on the same Hard Drive

Last night, was able to set up my computer hard drive to have two operating systems and I can boot to either one. It's awesome, now I can still have my expensive Windows for games, but I can have free Linux for everything else. I got instructions here (http://www.linuxquestions.org/questions/answers.php?action=viewarticle&artid=441) and this is how I did it. It can be done without erasing Windows, but that requires some software like "PQmagic." It was easier for me to just erase the drive. Here's how I did it. I'm using Windows XP Pro and Linux RedHat Fedora Core 3.

Step 1: Zero Fill the hard drive (zero fill means completely erase everything)

Step 2: Create Two Windows (XP) Partitions, but don't format your entire drive. Leave a bunch of space for Linux. Don't partition or format any of it in this step. I use two partitions because FAT32 is necessary for this process and NTFS allows me to have very large files. I have an 80GB hard drive, so I set up one FAT32 drive as 5GB and another NTFS partition of 15GB.

Step 3: Install Windows XP (I installed it onto my FAT32 partition)

Step 4: Install Linux RedHat - when you get to the section about formatting the hard drive, choose the Automatic Formatting option and then choose "use Empty Space".

Step 5: Jot down the root (/boot) partition name (i.e. /dev/hda# where # is the number of the partition - example /dev/hda3) - this is important. Also, jot down the name of the FAT partition.

Step 6: When asked about the Boot loader choose "Advanced options", then click next. Do not install the boot loader onto the "MBR". Instead choose the /boot partition name that you jotted down in step 5.

Step 7: Reboot to your Linux disk, but instead of choosing the regular install, choose "LINUX RESCUE". This will get you to a screen prompt.

Step 8: type "mkdir/mnt/windowsdrive"

Step 9: type "mount /dev/hda# /mnt/windowsdrive" (where # is the number of the FAT partition that you jotted down in step 5)

Step10: type "dd if=/dev/hda# of=/mnt/windowsdrive/bootsect.lnx bs=512 count=1" (where # is the number of the root (/boot) partition that you jotted down in step 5

Step 11: reboot your computer

Step 12: Windows XP will boot automatically. Go to the FAT32 Drive and copy the bootsect.lnx file to your C drive.

Step 13: Add c:\bootsect.lnx="Linux" to the end of C:\boot.ini and save. (Can't find boot.ini? That's becuase it's a hidden system file. Go up to tools-> folder options and uncheck the Hide Protected Operating System files.

Reboot your computer.

You will now notice that when you boot your computer up, you will be given 30 seconds to choose whether you want WindowsXP or Linux.

This post was written for Ben Bensen's enjoyment :)

2 comments:

Anonymous said...

Ben,

I hope you enjoyed it! I think I'll be stuck with a glazed expression on my face for the rest of the day! He-he-he :-)

A very computer illeterate Robin

Jason Smith said...

Yes Robin (and others), sorry about the confusion. This post would really only be interesting to computer geeks like me :)