Dual-booting Windows 7 and Ubuntu Karmic 9.10 on a RAID 0 array
15-Feb-2010 20 Comments
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.
-
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… -
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! -
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.- Switch to the second console by pressing CTRL-ALT-F2.
-
“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
-
Now you’re in. Install GRUB, and replace GRUB version 2′s files in
/boot/grubwith GRUB’s files.# apt-get install --purge grub # cp /usr/lib/grub/x86_64-pc/* /boot/grub/
-
Install GRUB on the MBR.
Let’s say your RAID 0 array is mapped to/dev/mapper/isw_abc_RAID.-
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. -
Now you’re ready for GRUB. Open the GRUB shell.
# grub --no-curses
-
Specify your RAID 0 array as the
(hd0)device since we’re installing to the MBR.grub> device (hd0) /dev/mapper/isw_abc_RAID
-
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
fdiskcommand you issued earlier. Note the syntax for thegeometrycommand: it’sgeometry drive cylinder head sector. Be careful not to mix up the values.grub> geometry (hd0) 19458 255 63
-
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
findcommand. Let’s assume it’s(hd0,2). -
Set GRUB’s root partition.
We pass the device reported by thefindcommand to therootcommand.grub> root (hd0,2)
-
And finally, install the GRUB boot loader on the MBR.
grub> setup (hd0)
-
Exit the GRUB shell.
grub> quit
-
First, get the drive geometry.
-
Configure GRUB.
You should be back on the Linux shell prompt. Quit the GRUB shell if you haven’t already.- Generate an initial
/boot/grub/menu.lstGRUB configuration file.# update-grub
-
Edit
/boot/grub/menu.lst(I usednano). Using the GRUB boot device you acquired via thefindcommand, change the line# groot=(hd0,0)
to
# groot=(hd0,2)
-
At this point you should also add the Windows 7 boot entry. Remember to insert this before the
### BEGIN AUTOMAGIC KERNELS LISTline or after the### END DEBIAN AUTOMAGIC KERNELS LISTline.title Windows rootnoverify (hd0,1) # use the correct partition for Windows!!! makeactive chainloader +1
-
Save your changes and then run
update-grubagain to generate the updated GRUB configuration file.# update-grub
- Generate an initial
-
Generate a new initramfs that loads the
dmraidkernel module.# echo dm-raid4-5 >> /etc/initramfs-tools/modules # update-initramfs -u
-
Edit
/etc/modulesto load thedmraidkernel module at boot.# echo dm-raid4-5 >> /etc/modules
-
You’re done! “Log out” from the Ubuntu installation.
logout
- 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!
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
Use
/dev/mapper/_RAID-0since 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.
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 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!!!
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 …
I get an “Error 22: No such partition”
when I run:
setup (hd,0)
in #4……. things are perfect before that.
I meant:
setup (hd0)
Can you post the output of every command in Steps 4.i. to 4.vi.?
Is this version stable?
Bryan
San Antonio Computer Repair
I can’t guarantee it, but I’ve had no problems (since 9.04) so far.
Note also that FakeRAID is not officially supported by Ubuntu.
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
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
Pingback: Ubuntu Lucid 10.04 on a RAID 0 array « The Hungry Programmer
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 ?
Try looking inside
/dev/mapper:Also do:
To get the “RAID set name” (
isw_abc_RAIDin my example above).Pingback: And I try, and I try, and I try
sometimes windows7 won’t install if you install it on a pc with a previous installation of windows XP *
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.
Pingback: Instalacja Ubuntu 10.10 na fake RAID0 | Ubuntu na vaio Z13
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.