Dual-booting Windows 7 and Ubuntu Karmic 9.10 on a RAID 0 array

I’ve been running a Windows XP-Ubuntu Jaunty setup on a single RAID 0 array for months without any problems. Now that I have some free time, I went ahead and updated my setup, documenting the steps here in case I decide to do this again tomorrow. (As a friend remarked, reformatting is a favorite pastime.)

Warning: Back up your data before attempting this procedure. I can’t guarantee that this will work for you. I got this running on my PC, which has Intel ICH9R RAID “FakeRAID” capability. Indeed, I copied most of the steps from the Ubuntu Community Documentation FareRaidHowto. Go ahead and read it first.


  • you already have Windows 7 installed on a partition in the RAID 0 array
  • you’re using the Ubuntu 9.10 alternate installer
  • you’ve backed up your data!


There are many. I advise you to read and try to understand all the steps first before proceeding with your installation.

  1. Start installing Ubuntu 9.10.
    Set your language, configure your network, partition your disk, create your user account, etc. Ubuntu 9.10 should be able to detect your RAID 0 array and ask you if you want to use it (say yes), so you should not encounter any problems. Until…

  2. Installation stops at the GRUB installation step.
    You’ll know when you see the Ubuntu installer main menu, with the Install the GRUB boot loader on a hard disk entry highlighted. Don’t press anything yet!

  3. Manually install GRUB onto the Ubuntu installation.
    Ubuntu 9.10 comes with GRUB version 2, which uses a new “BASH-like (configuration) syntax.” Sounds pretty cool, but I still need to learn it. For now I’ll use the old GRUB and my old configuration.

    1. Switch to the second console by pressing CTRL-ALT-F2.
    2. “Log in” to your new but incomplete Ubuntu installation (which is in /target) by entering the following in the command line.

      # mount --bind /dev /target/dev
      # mount -t proc /proc /target/proc
      # mount -t sysfs /sys /target/sys
      # cp /etc/resolv.conf /target/etc/resolv.conf
      # chroot /target
    3. Now you’re in. Install GRUB, and replace GRUB version 2’s files in /boot/grub with GRUB’s files.

      # apt-get install --purge grub
      # cp /usr/lib/grub/x86_64-pc/* /boot/grub/
  4. Install GRUB on the MBR.
    Let’s say your RAID 0 array is mapped to /dev/mapper/isw_abc_RAID.

    1. First, get the drive geometry.

      # fdisk -l /dev/mapper/isw_abc_RAID

      Look for the line saying something like 255 heads, 63 sectors/track, 19458 cylinders, and write it down.

    2. Now you’re ready for GRUB. Open the GRUB shell.

      # grub --no-curses
    3. Specify your RAID 0 array as the (hd0) device since we’re installing to the MBR.

      grub> device (hd0) /dev/mapper/isw_abc_RAID
    4. Set the drive geometry.
      This step probably isn’t required, as GRUB may have correctly acquired your drive’s geometry. I needed to do this for my setup, though.

      Use the geometry values from the fdisk command you issued earlier. Note the syntax for the geometry command: it’s geometry drive cylinder head sector. Be careful not to mix up the values.

      grub> geometry (hd0) 19458 255 63
    5. Find the boot directory partition.
      Get the drive (partition) where the GRUB boot images are installed.

      grub> find /boot/grub/stage1

      Write down the output of the find command. Let’s assume it’s (hd0,2).

    6. Set GRUB’s root partition.
      We pass the device reported by the find command to the root command.

      grub> root (hd0,2)
    7. And finally, install the GRUB boot loader on the MBR.

      grub> setup (hd0)
    8. Exit the GRUB shell.

      grub> quit
  5. Configure GRUB.
    You should be back on the Linux shell prompt. Quit the GRUB shell if you haven’t already.

    1. Generate an initial /boot/grub/menu.lst GRUB configuration file.
      # update-grub
    2. Edit /boot/grub/menu.lst (I used nano). Using the GRUB boot device you acquired via the find command, change the line

      # groot=(hd0,0)


      # groot=(hd0,2)
    3. At this point you should also add the Windows 7 boot entry. Remember to insert this before the ### BEGIN AUTOMAGIC KERNELS LIST line or after the ### END DEBIAN AUTOMAGIC KERNELS LIST line.

      title        Windows
      rootnoverify (hd0,1)  # use the correct partition for Windows!!!
      chainloader  +1
    4. Save your changes and then run update-grub again to generate the updated GRUB configuration file.

      # update-grub
  6. Generate a new initramfs that loads the dmraid kernel module.

    # echo dm-raid4-5 >> /etc/initramfs-tools/modules
    # update-initramfs -u
  7. Edit /etc/modules to load the dmraid kernel module at boot.

    # echo dm-raid4-5 >> /etc/modules
  8. You’re done! “Log out” from the Ubuntu installation.

  9. Switch back to the first console by pressing CTRL-ALT-F1 and finish the installation by selecting Continue without boot loader from the menu.

After the computer restarts you should be able to boot into your new Ubuntu installation. Congratulations!

Booting into Windows 7, however, will fail with a BOOTMGR is missing message. Didn’t you wish you did that backup?

No need to panic, though. Just boot your Windows 7 installation CD, click Repair your computer and it should detect the problem. Press Repair and restart.

Upon restarting, Windows 7 still fails to boot. Once again boot up the Windows 7 installation CD and click Repair your computer, and this time you’ll have access to the System Recovery Options dialog. Select Use recovery tools… and the Windows 7 entry from the list of operating systems. Click the Next button.

On the next dialog, select the Startup Repair link. Click Finish on the last dialog. After rebooting, Windows 7 should start correctly.

Feel free share your experiences in attempting this guide. Corrections are very much welcome as well. Good luck!

From this month’s Brainmail

60% of Twitter users are aged 35+.
Ref: The Times (UK)

Spending on corporate R&D increased by between 1 and 2% in the US and Europe during 2001 and 2006. In China the increase was 26%.
Ref: Economist (UK)

15 of the world’s 20 top oil companies are now state owned.
Ref: Foreign Policy (US)

In the US, the number of jobs done by telecommuters is predicted to grow by almost 400% by 2010.
Ref: World Future Society (US)

1/3 of the women that go to bed with James Bond end up dead.
Ref: Daily Telegraph (UK)

Read a lot more from Brainmail issue 56.