Arch Linux software RAID installation guide

This guide starts once the live CD has been booted and you've got a shell prompt.

Set keyboard layout:

# loadkeys uk

Load the raid modules

# modprobe raid0
# modprobe raid1
# modprobe raid5

Partition disks

partition /dev/sda

# cfdisk /dev/sda
cfdisk (util-linux-ng 2.13.0.1)
 
                                                 Disk Drive: /dev/sda
                                          Size: 203928109056 bytes, 203.9 GB
                                Heads: 255   Sectors per Track: 63   Cylinders:
24792
 
      Name             Flags        Part Type      FS Type[Label]           Size (MB)
------------------------------------------------------------------------------------------------------------------------
      sda1             Boot         Primary        Linux raid autodetect       222.09
      sda2                          Primary        Linux raid autodetect      2048.10
      sda3                          Primary        Linux raid autodetect     20003.89
      sda4                          Primary        Linux raid autodetect    181647.09

partition /dev/sdb

# cfdisk /dev/sdb
cfdisk (util-linux-ng 2.13.0.1)
 
                                                 Disk Drive: /dev/sdb
                                          Size: 203928109056 bytes, 203.9 GB
                                Heads: 255   Sectors per Track: 63   Cylinders:
24792
 
      Name             Flags        Part Type      FS Type[Label]           Size (MB)
------------------------------------------------------------------------------------------------------------------------
      sdb1             Boot         Primary        Linux raid autodetect       222.09
      sdb2                          Primary        Linux raid autodetect      2048.10
      sdb3                          Primary        Linux raid autodetect     20003.89
      sdb4                          Primary        Linux raid autodetect    181647.09

Create RAID arrays

(/boot **must** be RAID1)
# mdadm --create --verbose /dev/md1 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
# mdadm --create --verbose /dev/md2 --level=1 --raid-devices=2 /dev/sda2 /dev/sdb2
# mdadm --create --verbose /dev/md3 --level=0 --raid-devices=2 /dev/sda3 /dev/sdb3
# mdadm --create --verbose /dev/md4 --level=0 --raid-devices=2 /dev/sda4 /dev/sdb4

Format the newly created RAID drives

# mkfs.ext2 /dev/md1
# mkfs.ext3 /dev/md3
# mkreiserfs /dev/md4
# mkswap /dev/md2
# swapon /dev/md2

Mount your raid drives for installation

# mount /dev/md3 /mnt
# cd /mnt
# mkdir home
# mkdir boot
# mount /dev/md1 /mnt/boot
# mount /dev/md4 /mnt/home

Continue the setup from the menu. Skip the disk partitioning and mounting etc. and see below for bootloader.

# /arch/setup

Bootloader

Skip the last step (Installing the bootloader) as we need to do this manually because of our raid arrays. (Side note: When within the grub shell, "root" refers to the /boot partition. If you do not have a seperate boot partition, then the / partition.)

# grub

We need to install grub to both drives seperately.

Install to sda

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

Install to sdb

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

The last step is to edit grub's menu.lst file to ensure the system is bootable.

# (0) Arch Linux
title  Arch Linux
root    (hd0,0)
kernel /vmlinuz26 root=/dev/md3 ro md=1,/dev/sdb1,/dev/sdc1 md=3,/dev/sdb3,/
dev/sdc3 md=4,/dev/sdb4,/dev/sdc4 md=2,/dev/sdb2,/dev/sdc2
initrd /kernel26.img

Troubleshooting

Should your system not boot and you need to boot off the CD again to fix grub, you can easily jump to the last step of the install process by reassembling your raid arrays and then mounting them.

[root@archlive ~]# loadkeys uk
[root@archlive ~]#
[root@archlive ~]# modprobe raid0
[root@archlive ~]# modprobe raid1
[root@archlive ~]# modprobe raid5
[root@archlive ~]#
[root@archlive ~]# mdadm --assemble /dev/md1 /dev/sda1 /dev/sdc1
[root@archlive ~]# mdadm --assemble /dev/md2 /dev/sda2 /dev/sdc2
[root@archlive ~]# mdadm --assemble /dev/md3 /dev/sda3 /dev/sdc3
[root@archlive ~]# mdadm --assemble /dev/md4 /dev/sda4 /dev/sdc4
[root@archlive ~]#
[root@archlive ~]# mount /dev/md3 /mnt
[root@archlive ~]# mount /dev/md1 /mnt/boot
[root@archlive ~]# mount /dev/md4 /mnt/home
[root@archlive ~]#
Burtronix Banner W3C Banner