Dual Boot RAID Windows and Linux
Published: 4th August 2006 | Source: OC3D Forum |Linux
Reboot with your favourite distro install disk in the CD drive. For this to work you'll need a distro with the kernel on the install CD that supports two features: MD and LDM. The first, MD is the multiple disk driver - your software RAID support. It handles everything from RAID 0 to RAID 6 and JBOD. The other allows Linux to read and work with LDM, or Logical Disk Manager (aka Dynamic Disk) partitions. Without the LDM driver, ther kernel only sees a generic unified partition which Windows uses as its 'Dynamic Disk' format. Thankfully the LDM driver for Linux exists, or this guide wouldn't be possible.
#Note: Generally, MD and LDM are so common any modern distro should have them built into their kernels. If you prefer to build your own kernel on an install disk, you'll find LDM under Filesystems-> Partition types (then select 'Advanced Partition Selection' and Windows Logical Disk Manager') and the MD driver under Drivers-> Multi-disk driver.
1. At the partition stage you should be able to see and manipulate the same partitions you made in Windows. All you want to do here is create the Linux software RAID 0 array and install Linux onto it, with the exception of /boot. You may need to modprobe the MD driver if your distro doesn't load it. The LDM driver is a compile-in only affair.
2. If you're doing things the manual way (such as with Gentoo) you'll need to make sure the tools from either the 'raidtools' or 'mdadm' packages are available on the install disk. You can assemble your RAID 0 array with mdadm like so:
/dev/sdb2 -n 2 -1 0 -c 64
Distributions that have no problem loading and using both MD and LDM include Red Hat, SuSE, Mandriva, and Gentoo. The first three even include install features to setup RAID arrays from partitions for you. Neat eh!!!
3. Allocate the partitions as per the layout you want, and install Linux. Going by the diagram I had included previously, this means allocating /dev/sda2 and /dev/sdb2 to md0, /dev/sda3 and /dev/sdb3 to md1, and installing / to md0 and allocating your swap to md1.
#Note: You can also use other methods of building drives into spanned file systems with evms, device mapper, and the like but as you'll see sticking with straight MD keeps it simple and, as I'll cover below, cross platform.
The Boot Loader
So far, it's been relatively simple. It's just a standard dual boot install making use of software RAID under each OS, and it's been made possible by the kernel's support of LDM. Which if you think about it presents us with a bit of a chicken and egg problem: In order to see LDM partitions, the kernel needs to load. But in order to load the kernel...the partitions need to be visible. No problerm!!! Well, actually it is a little. There are two ways to handle this.
A) The first is to install your /boot and boot manager to a third hard drive. Even if it's just a simple data drive, there's nothing stopping you making this your bootable drive in the system, loading a Linux boot manager, and booting Linux or Windows accordingly. It's certainly a safe and simple option. Alternatively, this boot device could be a USB key.
B) The other option is to install LILO onto the second drive (so as to not overwrite the Windows NT boot manager, which you need). LILO can handle LDM partitions, whereas Grub cannot, so it's your only choice here. Your distro, if it's got a nice installer, will offer to install LILO for you and will even find and add to the boot menu your Windows boot. Just because you're running different OS's, and different software RAID arrays no less, doesn't mean the two can't play together. You'd think that the chances of Windows being able to read a Linux software RAID array are next to nil. And you'd be right. You'd also think that, naturally, Linux wouldn't be able to read that lovely NTFS Windows software RAID array from Windows. But in actual fact it can. To be more precise, the MD driver can, with no more configuration than you've already done to setup a Linux software RAID array. The easiest way to do this on a permanent basis where you can mount and unmount the Windows RAID as you desire is to set it up as an entry in your /etc/raidtab, like so:
The two most important settings to specify here are 0 for the persistent superblock (because of course NTFS partitions don't), and to use a chunk size of 64KB. And of course, you need the NTFS file system module installed or loadable. After that, accessing the Windows RAID is as simple as running:
mount -t ntfs /dev/md2 /mnt/windows
Or whatever directory you want to mount it to. The raid0run command is part of the 'raidtools' package. You could probably use mdadm to force it to run, but raid0run will do as it says without playing with switched. The raid0run command forces the assembly of a RAID device, irrespective of whether the partitions sport a valid superblock or not. You can unmount it anytime with:
#Note: If MD complains that there aren't enough MD devices present in /dev, you can make another like so ( the example being here md2):
mknod 2 b 9 2
Now that we've installed Windows and Linux and organised the boot loader, let's get onto booting up...