Reinstalled Windows 7 on new HDD, installed Linux over previous Windows 7 on old HDD, how to dual boot?

Posted on

QUESTION :

I reinstalled Windows 7 on my new HDD, installed Linux over the previous Windows 7 on the old HDD. How do I dual boot?

It seems that I overrided the Windows bootsector in the original HDD that was able to redirect to new HDD where new Windows is.

Do I need to create some kind of Windows bootsector to the new HDD that has an NTFS filesystem, or can I direct the GRUB2 bootloader directly to the HDD that has Windows installed? If so, how do I do it?

Update: This is not a question of how to use GRUB2. It seems that something might be missing in the Windows 7 HDD. I used the Windows installation DVD and its command prompt to set the MBR to the NTFS HDD bootsect /nt60 all and went from BIOS directly to that HDD. It complained that the disk had no bootloader. I think that even if I set a GRUB chain, it would not work.

ANSWER :

GRUB supports a style of booting called chainloading, where it punts off to another existing bootloader. This style is made necessary here because GRUB has no idea how to boot Windows, which as far as I know, is not multiboot compliant.

If you are using GRUB Legacy:

  1. Open up the file /boot/grub/menu.lst
  2. Add the following text:

    title Windows 7
    root (hdx,y)
    makeactive
    chainloader +1
    

For GRUB 2:

  1. Open up the file /etc/default/grub
  2. Add the following lines:

    menuentry "Windows 7" {
    set root=(hdx,y)
    chainloader +1
    }
    

Either way, replace the x with your hard drive number and your the y with Windows 7’s partition number. To find that out, open up a partition editor like GParted.

For reference, both the hard drive number and the partition number start from 0. So, for example:

  • First Hard Drive, Second Partition => (hd0, 1)
  • Second Hard Drive, First Partition => (hd1, 0)
  • Ninth Hard Drive, Twenty Second Partition => (hd8, 21)
  • etc.

You should be able to use the bios boot select menu to select the drive you want to boot. This can usually be accessed by selecting a key like F2/F10/F12/ESC at boot time. The benefit to doing it this way is that each OS has it’s own Bootloader.

Leave a Reply

Your email address will not be published.