RAID/dm-raid45

Extending Device Mapper RAID with RAID4/RAID5 Support
At present, the linux kernel only supports dmraid (a.k.a. fakeraid, BIOSraid) raid0, raid1, and raid10. However, there is a kernel patch which adds support for raid4 and (most importantly) raid5. This page provides the steps needed to apply the dm-raid45 kernel patch to gentoo-sources, and configure genkernel to use the updated dmraid module from portage, with the end result being the ability to boot into gentoo with a dmraid-raid5 root partition.

Patching the Kernel
The kernel patches are available here: http://people.redhat.com/heinzm/sw/dm/dm-raid45/. As of this writing, this page only provides patches supporting kernels up to 2.6.29. However, there are patches for 2.6.30, 2.6.31, 2.6.33, 2.6.36, 2.6.38, and 3.0.6 available here: * 2.6.29: http://people.redhat.com/heinzm/sw/dm/dm-raid45/dm-raid45_2.6.29.1_20090424.patch.bz2 * 2.6.30: http://omploader.org/vMmU5Ng/dm-raid45_2.6.30.patch.bz2 * 2.6.31: http://omploader.org/vMmU5cg/dm-raid45_2.6.31.patch.bz2 * 2.6.33: http://tmb.mine.nu/Mandriva/Cooker/dm-raid/dm-raid45-buildfix-for-2.6.33.patch *         and http://tmb.mine.nu/Mandriva/Cooker/dm-raid/dm-raid45_2.6.33-rc1-20091126.patch * 2.6.36: http://dmraid-patches.googlecode.com/files/linux-2.6.36-gentoo-r5-dmraid.patch * 2.6.38: http://dmraid-patches.googlecode.com/files/linux-2.6.38-gentoo-r6-dmraid.patch * 3.0.6:  http://dmraid-patches.googlecode.com/files/linux-3.0.6-gentoo-r6-dmraid.patch

You can apply the kernel patch using the instructions below. Note, these instructions assume that you have set up the symlink to point to the correct kernel sources.

For later kernels, you can find patches at Suse's patch set, at

https://build.opensuse.org/package/files?package=kernel-source&project=Kernel%3AHEAD

Download patches.suse and apply all dm-raid* and dmraid patches.

Congratulations, your kernel has now been altered and the dm-raid45 module can now be selected in menuconfig.

Using DMRAID from portage with Genkernel
Genkernel bundles its own version of dmraid (1.0.0.rc14 as of this writing), which may or may not support dm-raid45. The latest version of dmraid available in portage improves support for various hardware (especially isw) and should properly support dm-raid45. Using dmraid from portage is a two-step process: emerging the latest, and editing.

Instructions are provided after the installation process completes on which lines in genkernel.conf need to be updated. They are also listed below:

Putting it all together
Now that genkernel has been set up to use the latest and greatest dmraid package, build and install a new kernel with dm-raid45 support:

(you could compile-in this module too if you prefer)

Edit grub to boot your new kernel, and voila!