Gentoo software RAID

Gentoo Software RAID

Software RAID massives

You can check your RAID/LVM support with this command

cat /boot/config-`uname -r` | egrep 'RAID|LVM'
CONFIG_RAID_ATTRS=m
CONFIG_BLK_DEV_3W_XXXX_RAID=m
CONFIG_SCSI_AACRAID=m
CONFIG_MEGARAID_NEWGEN=y
CONFIG_MEGARAID_MM=m
CONFIG_MEGARAID_MAILBOX=m
CONFIG_MEGARAID_LEGACY=m
CONFIG_MEGARAID_SAS=m
CONFIG_MD_RAID0=m
CONFIG_MD_RAID1=m
CONFIG_MD_RAID10=m
CONFIG_MD_RAID456=m

Kernel Config

 Device Drivers
 Multi-device support (RAID and LVM)
 Multiple devices driver support (RAID and LVM) (MD [=y])
 RAID support (BLK_DEV_MD [=y])

Load modules:

modprobe raid0
modprobe raid1
modprobe raid10

Partitions with “cfdisk”

cfdisk (util-linux-ng 2.13.1.1)
 
Disk Drive: /dev/sda
Size: 80025280000 bytes, 80.0 GB
Heads: 255   Sectors per Track: 63   Cylinders: 9729
 
Name               Flags             Part Type        FS Type                   [Label]                Size (MB)
-----------------------------------------------------------------------------------------------------------------------------
sda1               Boot               Primary         Linux raid autodetect                               115.16
sda2                                  Primary         Linux swap / Solaris                               4087.97
sda3                                  Primary         Linux raid autodetect                             75820.64

Put partiton table from /dev/sda to /dev/sdb /dev/sdc1 /dev/sdd1 (:

sfdisk -d /dev/sda | sfdisk /dev/sdb | sfdisk /dev/sdc | sfdisk /dev/sdd

Create MD devices

cd /dev
MAKEDEV md

!!! Linux can’t boot from software RAID 10 we make new BOOT partition with RAID1

# Create Boot partition
mdadm --create --verbose /dev/md0 --level=1 --raid-devices=4 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1

#Create Root partition

mdadm --create --verbose /dev/md1 --level=10 --raid-devices=4 /dev/sda3 /dev/sdb3 /dev/sdc3 /dev/sdd3

Watch our RAID creation

watch cat /proc/mdstat
watch -n1 'cat /proc/mdstat'

Update the mdadm config file.

mdadm --detail --scan >> /etc/mdadm.conf

# GRUB CONFIG

grub> find /boot/grub/stage1
(hd0,0)
(hd1,0)
(hd2,0)
(hd3,0)
grub>

#Install to drive 1

grub> device (hd0) /dev/sda
grub> root (hd0,0)
grub> setup (hd0)

#Install to drive 2

grub> device (hd0) /dev/sdb
grub> root (hd0,0)
grub> setup (hd0)

#Install to drive 3

grub> device (hd0) /dev/sdc
grub> root (hd0,0)
grub> setup (hd0)

#Install to drive 4

grub> device (hd0) /dev/sdd
grub> root (hd0,0)
grub> setup (hd0)

Set grub menu.list

!!!!! change real_root=/dev/md???? whith your RAID ROOT configuration !!!!!!!!

echo -e "default 0\ntimeout 3\n\ntitle=Gentoo Linux (2.6.29-gentoo-r1-VHristev)\nroot (hd0,0)" > /boot/grub/grub.conf
echo "kernel `ls /boot/kernel*` root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/md1 udev" >> /boot/grub/grub.conf
echo "initrd `ls /boot/initramfs*`" >> /boot/grub/grub.conf
grep --invert-match rootfs /proc/mounts > /etc/mtab