Linux Noob: Linux and Windows Living Together: A World Gone Mad!


So, I have recently had the experience of puzzling out how to dual boot Linux (FC14) and Windows 7.  Now, if you know what you’re doing this is cake.

IMPORTANT SAFETY TIP: INSTALL WINDOWS FIRST!

However, easy isn’t exactly fun or educational.   I initially re-imaged my laptop with 3 partitions:

  • 500MB /boot
  • 4GB /swap
  • the rest-of 500GB-ext4

Whoops!  As you can see, I forgot to account for a Windows partition.   Cue circus music.

So, after I spent considerable time setting up my Linux environment, I realized my mistake.  Not wanting to repeat a week’s worth of work, I started looking for a magically solution.  I will say that you can do incredibly crazy-and dangerous- things in Linux that you would never think of in Windows.  Here is how I was able to researve a 130GB partition and get Windows 7 dual booting.

First, I fired up GParted.  This is the Gnome Partition app.  There are several way to run this.  I chose to use a USB boot device (http://gparted.sourceforge.net/liveusb.php#linux-method-b).  There are several methods to create a bootable USB stick.  I elected to got the manual route.  It is the most straight-forward process and doesn’t have any extraneousness nonsense in the mix.  Once the stick was prepped, I rebooted the laptop and repartitioned the main partition giving me ~130GB (detailed instructions are found at http://gparted.sourceforge.net/).

Next, I tested my work and Linux booted up without issue.  Now for Windows.

I crammed the Windows 7 64bit install DVD in the drive and installed it on the newly created partition.  Once completed.  I had the hotness of Windows 7 running but no Linux.  <sigh>  So, this is where it gets a bit scary for me but it’s really not bad being on the other side of it.

I found an app called SuperGrubDisk to fix the problem.  As you are probably aware, when Windows was installed, it assumed control of the Master Boot Record, disregarding the Grub bootloader.  SGD will allow you to recover your Grub fully intact.  Just download the .iso at http://www.supergrubdisk.org/super-grub-disk/.  They have several products for fixing MBRs but I really only needed SuperGrubDisk1.  Once the disk was burned, I rebooted the machine that loads up SGD and I was greeted with a text menu system (details on this app on on the site).  I followed the instructions, completed my very, scary activities, and then rebooted.  WOOHOO!  Linux is back.

Windows is gone.  Damn.  Well, gone… kind of.  At this point we are just talking about the MBR.  Both OSs are installed and work fine, it’s just a matter of getting access to both of them easily.

So, the next step was to edit the Grub.conf file.  This is found in the /etc directory.

IMPORTANT SAFETY TIP: BACK UP YOUR FILE BEFORE MODIFYING

[muppet@computer ~]  cp /etc/grub.conf /etc/grub.conf_orig

Here’s what I did:

Since I have one drive with 4 partitions (3 for Linux and 1 for Windows with Windows being the last one), you refer to the target partition as hd(0,3).

[muppet@computer ~]  sudo gedit /etc/grub.conf

I only had to change 2 things:

  • Timeout setting from 0 to 15
  • Add the windows loader entry at the bottom (after the Linux entries) like this:
title Microsoft Windows 7 Ultimate
rootnoverify (hd0,3)
chainloader +1

Finally I saved the file and rebooted the laptop.

Now for the moment of truth.  By now, you would be really miffed if I ended this by saying I roached my box and had to start all over.  I would have been upset too.  The end result was that I got a grub loader message displaying my default OS (FC14) with a 15 sec countdown.  If you hit the ESC key, it will stop the timer and give you all the options.

So, this was an exciting adventure in Linux, being something that I have never done before.  The scary parts were actually repartitioning the drive, reloading the the Grub bootloader, and finally editing the grub.conf file (I once brought a Linux box down to it knees by fooling with the MBR).

FINAL SAFETY TIP: BACK UP YOUR LINUX OS PRIOR TO ATTEMPTING ANY OF THIS.

So there you have it.  A very scary and exciting fix to what could have been a night of reloading.  I hope you found this helpful.  If you would like more details about the partitioning and MBR process, just let me know.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s