Hi all
I want to share my experiment with installing linux on a 3 disk md raid10.
My rig:
Amd phenomII X4, 3.4 GHz
4 GB DDR2
2 x 1 TB Sata HDD /dev/sda,/dev/sdb
1 x 2 TB Sata HDD /dev/sdc
Why raid10:
There are two types of raid hardware and software. The hardware raid you find on motherboards is more a sort of software raid. I choose for software raid with the md driver because then it is possible to use raid10 with 3 disks and/or partitions, from which you may lose one disk without losing your system and you get better read performance with big files because the data is striped across the disks so you can read from multiple spindels. With hardware raid10 you need 4 disks,which are divided in 2 pairs. From each pair you may lose 1 disk.
So for more performance and more safety. Warning raid is no substitute for back-up. But there is a price. You lose half your disk space so with my setup two 1 TB disks and one 2 TB disk which I divided in two because raid10 needs equally sized disk/partitions.
I get a 3 TB raid10 which gives a usable space of 1.5 TB.
I used a Slackware current ISO which I put on a usb stick with unetbootin.
The boot order in BIOS was set to sdc. And I used the BIOS boot menu by pressing F8 to boot the usb stick.
The first thing I did was create two partitions on sdc. A small 30 MB boot partition which will not be a part of the raid10 array because lilo can not boot from a software raid10. And a second partition of 1 TB. After deleting all partitions from sda and sdb. I created the raid10 array.
Code:
bash-4.1# mdadm --create /dev/md_d0 --auto=yes --level=raid10 --bitmap=internal --layout=f2 --chunk=256 --raid-devices=3 --metadata=0.90 /dev/sda /dev/sdb /dev/sdc2
Here after, I created 3 partitions on the raid10 array with
I aligned the partition on 3072 Bytes to be sector aligned and stride aligned. After some more reading I discovered that stride aligning is not necessary with raid10 so sector aligning with 1024 bytes should be enough. I created a 4 GB swap partition to get hibernate functioning in the future ;-) A 12 GB root partition and a 60 GB home partition.
Code:
Disk /dev/md_d0: 1499.8 GB, 1499837497344 bytes
2 heads, 4 sectors/track, 366171264 cylinders, total 2929370112 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 786432 bytes
Disk identifier: 0xaddf2727
Device Boot Start End Blocks Id System
/dev/md_d0p1 6144 8404991 4199424 82 Linux swap
/dev/md_d0p2 8404992 33570815 12582912 83 Linux
/dev/md_d0p3 33570816 159399935 62914560 83 Linux
Then I ran setup. The only difference with a normal setup was that I choose the expert lilo setup. So that I could point lilo to /dev/sdc as boot device. And lilo would not run with /dev/md_d0p2 as root so for the moment I used /dev/sdc1 as root. When rebooting I gave as a parameter the real root.
After finishing the setup and rebooting. It failed miserably.
After some more reading I added as kernel parameter
Code:
raid=part md=d0,/dev/sda,/dev/sdb,/dev/sdc2 root=/dev/md_d0p2
Now it failed less miserably, I got two array's md0 with sdc2 and md_d0 with sda and sdb but because it is a raid10 I could boot with 1 missing drive in /dev/md_d0. After searching through start up scripts and udev rules. I discovered that it was md that created the problem with it's autodetection. I stopped the array md0 and added sdc2 back to the array. I put the following append in lilo.conf and adjusted the root.
Code:
append=" raid=noautodetect md=d0,/dev/sda,/dev/sdb,/dev/sdc2"
root = /dev/md_d0p2
My Lilo.conf
Code:
# LILO configuration file
# generated by 'liloconfig'
#
# Start LILO global section
boot = /dev/sdc
compact # faster, but won't work on all systems.
# Boot BMP Image.
# Bitmap in BMP format: 640x480x8
bitmap = /boot/slack.bmp
# Menu colors (foreground, background, shadow, highlighted
# foreground, highlighted background, highlighted shadow):
bmp-colors = 255,0,255,0,255,0
# Location of the option table: location x, location y, number of
# columns, lines per column (max 15), "spill" (this is how many
# entries must be in the first column before the next begins to
# be used. We don't specify it here, as there's just one column.
bmp-table = 60,6,1,16
# Timer location x, timer location y, foreground color,
# background color, shadow color.
bmp-timer = 65,27,0,255
# Standard menu.
# Or, you can comment out the bitmap menu above and
# use a boot message with the standard menu:
#message = /boot/boot_message.txt
# Append any additional kernel parameters:
append=" raid=noautodetect md=d0,/dev/sda,/dev/sdb,/dev/sdc2 vt.default_utf8=1"
prompt
timeout = 50
# VESA framebuffer console @ 1024x768x64k
vga = 791
# End LILO global section
# Linux bootable partition config begins
image = /boot/vmlinuz
root = /dev/md_d0p2
label = Linux
read-only # Partitions should be mounted read-only for checking
# Linux bootable partition config ends
And now it worked flawlessly after running lilo.
info:
http://linux.die.net/man/8/mdadm
https://raid.wiki.kernel.org
http://spinics.net/lists/raid/maillist.html