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.

Assumptions

  • 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!

Steps

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)
      

      to

      # 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!!!
      makeactive
      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.

    logout
    
  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!

Advertisements

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

  1. kuko says:

    hi;
    im newbie for raid and i dont understand point #4:
    “Install GRUB on the MBR.
    Let’s say your RAID 0 array is mapped to /dev/mapper/isw_abc_RAID”

    isw_abc_RAID which partition is this?
    i have in ../mapper/ _RAID-0; _RAID_01 = ntfs; _RAID-02=extended; _RAID-05=/

    so could u plz explain which one should i use instead of your “isw_abc_RAID”

    than #6
    echo dm-raid4-5 >> /etc/initramfs-tools/modules
    is this needed for raid0?
    thx

    • neildecapia says:

      Use /dev/mapper/_RAID-0 since you’re installing to your device’s Master Boot Record (MBR). _RAID-01, _RAID-02, etc. are the partitions within your (RAID) device.

      As for #6, I just copied this from the Ubuntu Community Documentation’s FakeRaidHowto. Come to think of it, this step may not be needed indeed. Maybe you can try skipping this step and then share your results so we can find out if we can remove it (and #7 as well)? Thanks.

  2. kuko says:

    geometry;
    without specifying it i got no error however after reboot still got only M$ bootloader…

    #6
    echo dm-raid4-5 >> /etc/initramfs-tools/modules is not needed (at least for my raid0)

    THX A LOT FOR POSTING THIS!!!

  3. kuko says:

    &lt3 u!!!!! i spent with this 3 days! finally i got it work just coz of your hint with grub> geometry;
    without specifying it i got no error however after reboot still got only M$ bootloader…

    #6
    echo dm-raid4-5 >> /etc/initramfs-tools/modules is not needed (at least for my raid0)

    THX A LOT FOR POSTING THIS!!!

  4. kuko says:

    for those who would like to try win console commands bootrec /fixboot and /fixmbr it wont help with booting win7 just wipe out grub & you have to boot live cd and do the trick with grub > setup …

  5. adam says:

    I get an “Error 22: No such partition”

    when I run:
    setup (hd,0)

    in #4……. things are perfect before that.

  6. adam says:

    I meant:

    setup (hd0)

  7. bryan keller says:

    just remember raid 0 means NO REDUNDANCY, you lose one drive you lose everything on both drives!!

    You could go with raid 0+1 or 1+0 that way you get the speed of the raid 0 and the redundancy.

    The best of both worlds!

    Bryan

    San Antonio Computer Repair

  8. Ken Hyer says:

    Thank you SO MUCH for posting this! My Ubuntu 9.04 install stopped booting after a kernel update. Ubuntu 10.04 won’t install with RAID0 (known bug), so I was going to switch to Fedora, but couldn’t get any of the NVIDIA stuff working right. So I’m back to 9.10, and the grub error happens. But after walking through your solution, everything is good :) Thanks again for the very clear and detailed instructions.

    Ken

  9. Pingback: Ubuntu Lucid 10.04 on a RAID 0 array « The Hungry Programmer

  10. kumpa says:

    gawd, i am also lost at step 4 (and i am total linux noob).Btw i have sony vaio vpcz1, how can i find out what my raid array is mapped to ?

    • neildecapia says:

      Try looking inside /dev/mapper:

      # ls -l /dev/mapper

      Also do:

      # sudo dmraid -s

      To get the “RAID set name” (isw_abc_RAID in my example above).

  11. Pingback: And I try, and I try, and I try

  12. sometimes windows7 won’t install if you install it on a pc with a previous installation of windows XP *

  13. Siddhartha says:

    Neil, thank you so much! Saved my life. I can confirm the instructions work for 10.04, at least on my RAID-0 box. Haven’t checked the absolute last step (restoring Win7 boot) yet.

  14. Pingback: Instalacja Ubuntu 10.10 na fake RAID0 | Ubuntu na vaio Z13

  15. lieuthier says:

    Hey there,

    This is the error I got:

    Running “install /boot/grub/stage1 (hd0,5) /boot/grub/stage2 p /boot/grub/menu.lst” … failed
    Error 22: No such partition

    That was after the grub> setup (hd0) command line.

    Thanks in advance.

Leave a Reply

Fill in your details below or click an icon to log in:

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

%d bloggers like this: