Home > GNU/Linux > Installing Mandriva 2007 Spring (and above ...) on a RAID 0 (...)
Installing Mandriva 2007 Spring (and above ...) on a RAID 0 configuration
Monday 20 August 2007, by
I encountered some problems in setting up a RAID 0 partition under Mandriva Spring since it did not recognised my setup after the reboot.
I posted a bug report and this is now solved, the incoming 2008.0 does not have the problem any more.
This page is just a little help for those who have encountered this problem and may want some tricks for debugging and solving it (this is more or less distribution-agnostic).
I set up a RAID 0 stripe under the bios, this is called fake-RAID by some since this does not abstract all the RAID features, for my little personnal system, i can live with these shortcomings.
Here we go with the simplified debugging procedure:
Getting the dm partition
dmsetup table
isw_cbbchfdche_raidmainp6: 0 165742542 linear 253:0 41608413
isw_cbbchfdche_raidmainp5: 0 33238422 linear 253:0 8369928
isw_cbbchfdche_raidmainp3: 0 20482875 linear 253:0 207350955
isw_cbbchfdche_raidmainp2: 0 198981090 linear 253:0 8369865
isw_cbbchfdche_raidmainp1: 0 8369802 linear 253:0 63
isw_cbbchfdche_raidmain: 0 1250275840 striped 2 256 8:0 0 8:16 0
This is what i could extract from the linuxrc contained in the boot partition of a fedora installation:
rmparts sdb
rmparts sda
dm create isw_cbbchfdche_raidmain 0 1250275840 striped 2 256 8:0 0 8:16 0
dm partadd isw_cbbchfdche_raidmain
Creating a correct initrd
The only thing i had to do was extracting the initrd, patching the boot sequence in order to provide the missing module (dm_mirror for instance, and dmraid.static binary to detect and setup the mirror).
Extracting the old initrd (as root)
mkdir /root/initrd_to_correct
cd /root/initrd_to_correct
gzip -dc /mnt/Mandriva2007Spring64/boot/initrd-2.6.17-13mdv.img | cpio -i -d
Add the missing programs and modules
cp /sbin/dmraid.static bin/dmraid (note i pruned the .static part)
cp /lib/modules/2.6.17-13mdv/kernel/drivers/md/dm-mirror.ko.gz lib/
cp /lib/modules/2.6.17-13mdv/kernel/drivers/md/dm-mod.ko.gz lib/
cp /lib/modules/2.6.17-13mdv/kernel/drivers/md/dm-zero.ko.gz lib
cp /lib/modules/2.6.17-13mdv/kernel/drivers/scsi/scsi_wait_scan.ko.gz lib/
cp /lib/modules/2.6.17-13mdv/kernel/drivers/scsi/sd_mod.ko.gz lib/
cp /lib/modules/2.6.17-13mdv/kernel/drivers/scsi/scsi_mod.ko.gz lib/
cd lib
gunzip *.gz
the linuxrc script (here called init) needs to be updated:
##### <- this indicates some lines of context
##### (you should already have them without the starting dashes)
##### echo "Loading usbhid.ko module"
##### insmod /lib/usbhid.ko
echo "Loading dm-mod.ko module"
insmod /lib/dm-mod.ko
echo "Loading dm-mirror.ko module"
insmod /lib/dm-mirror.ko
##### echo "Loading scsi_mod.ko module"
##### insmod /lib/scsi_mod.ko
echo "Loading sd_mod.ko module"
insmod /lib/sd_mod.ko
##### echo "Loading libata.ko module"
##### insmod /lib/libata.ko
##### mount -t sysfs none /sys
##### echo Creating device files
##### mountdev size=32M,mode=0755
##### mkdevices /dev
##### Just after the above lines (no empty line), add this:
echo Making device-mapper control node
mkdmnod
echo Activating device-mapper raid devices
dmraid -ay -i
##### echo Creating root device
##### mkrootdev /dev/root
recreate the correct initrd
find ./ | cpio -c -o > /boot/new-initrd.img
gzip /boot/new-initrd.img
replace the old initrd by the new one
cp /mnt/Mandriva2007Spring64/boot/initrd-2.6.17-13mdv.img /mnt/Mandriva2007Spring64/boot/initrd-2.6.17-13mdv.img_orig
mv /boot/new-initrd.img /mnt/Mandriva2007Spring64/boot/initrd-2.6.17-13mdv.img
Will the problem be solved for next releases (and a fix provided for Spring)?
To get the maximum chances, i have opened a gug report on Mandriva’s brand new bugzilla at http://qa.mandriva.com/show_bug.cgi?id=30982.
Performances
Once correctly set up, i wanted to check rapidly if getting two hard drives was faster than only one on my cmputer:
Testing the two drives simulnateously (RAID 0):
hdparm -Tt /dev/mapper/isw_cbbchfdche_raidmain
/dev/mapper/isw_cbbchfdche_raidmain:
Timing cached reads: 17900 MB in 2.00 seconds = 8967.88 MB/sec
HDIO_DRIVE_CMD(null) (wait for flush complete) failed: Inappropriate ioctl for device
Timing buffered disk reads: 354 MB in 3.02 seconds = 117.39 MB/sec
HDIO_DRIVE_CMD(null) (wait for flush complete) failed: Inappropriate ioctl for device
Testing one drive:
hdparm -Tt /dev/sda
/dev/sda:
Timing cached reads: 17144 MB in 2.00 seconds = 8588.77 MB/sec
Timing buffered disk reads: 202 MB in 3.00 seconds = 67.26 MB/sec
That’s an impressive 75% boost in read! (i did more extensive tests with various conditions/load with roughly the same result). This is not exactly twice the performance but that’s worth enough setting up a RAID partition.
Installing grub on a /boot partition:
In case you messed up badly your grub configuration, this is what i picked from another web site. Beware, i provide it only for additionnal information since it is untested!!!
# Grub should not detect bios device names itself! Do this or be a fool!:
/sbin/grub --device-map=/dev/null
# (hd0,0) is the first partition on the first disk (from bios point of view!!)
grub> device (hd0,0) /dev/mapper/sil_adbibjadbcbab1
# (hd0) is the first disk (and thus containing (hd0,0) )
grub> device (hd0) /dev/mapper/sil_adbibjadbcbab
# That's it, the rest should be easy:
grub> root (hd0,0)
Filesystem type is fat, partition type 0x4
grub> setup (hd0,0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/fat_stage1_5" exists... yes
Running "embed /boot/grub/fat_stage1_5 (hd0,0)"... failed (this is not fatal)
Running "embed /boot/grub/fat_stage1_5 (hd0,0)"... failed (this is not fatal)
Running "install /boot/grub/stage1 (hd0,0) /boot/grub/stage2 p /boot/grub/menu.lst "... succeeded
Done.
To go further
http://people.redhat.com/ heinzm/
http://tienstra4.flatnet.tudelft.nl/ gerte/gen2dmraid/
http://www.linuxquestions.org/linux/answers/Hardware/How_to_boot_from_RAID_using_dmraid
http://forums.gentoo.org/viewtopic-t-258981-highlight-gen2dmraid.html
https://bugs.launchpad.net/ubuntu/+source/mdadm/+bug/103177
http://qa.mandriva.com/show_bug.cgi?id=29989
http://qa.mandriva.com/show_bug.cgi?id=30639
http://tienstra4.flatnet.tudelft.nl/ gerte/gen2dmraid/dmraidinitrd
http://tienstra4.flatnet.tudelft.nl/ gerte/gen2dmraid/linuxrc
http://www.cyberciti.biz/tips/10-boot-time-parameters-you-should-know-about-the-linux-kernel.html
Special thanks
To all who helped me in extracting the initrd, finding out the problem and solving it, most of them can be joined on irc, on #mandriva (or #mandrivafr).
P.S.
2008, January 16: updated the module list since scsi ones where missing.
2008, January 17: updated the module list AND added the -c option to the cpio parameters for recreating the archive, otherwise it does not boot.
2008, January 27: little update for cpio, in decompressing mode, -i -d is needed to create subdirectories.
6 Forum posts