Friday, June 13, 2008

Installing Slackware 12 on a software RAID device

This HOWTO assumes that you're going to perform a fresh installation of Slackware 12. So lets start :

In this howto, i install Slackware on 3 sofware RAID0 configurations using mdadm. One for /, one for /home and another one for /mnt/extras.

Boot up the Slackware DVD
and log in as root.

Use cfdisk to create the partitions on the harddrives :

The partitioning scheme for my 2 x 80GB SATA harddrives :

/dev/sda :
sda1 Primary Linux ext3 139.83
sda2 Primary Linux raid autodetect 5116.13
sda3 Primary Linux raid autodetect 59411.20
sda4 Primary Linux raid autodetect 15356.60

/dev/sdb :
sdb1 Primary Linux raid autodetect 5116.13
sdb2 Primary Linux raid autodetect 59411.20
sdb3 Primary Linux raid autodetect 15356.60

sda1 is a 140MB partition dedicated to hold the kernel image as well as the bootloader since no bootloader i know of can boot off a software RAID 0 array.

Build your arrays with Multiple Devices Admin (mdadm) program ( level=0 : Striped/RAID0, level=1 : Mirrorred/RAID1, level=4/5/6/10, man mdadm for more help on this )
  • mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sda2 /dev/sdb1 # for root
  • mdadm --create /dev/md1 --level=0 --raid-devices=2 /dev/sda3 /dev/sdb2 # for home
  • mdadm --create /dev/md2 --level=0 --raid-devices=2 /dev/sda4 /dev/sdb3 # for anything else ;)

Now fire up the installation as usual (# setup)
Now, when it comes to selecting partitions, pick /dev/md0 as the target for "/" (root)
As you progress in the installer, create the mountpoints :
  • "/home" for the device "/dev/md1"
  • "/boot" for the bootloader on "/dev/sda1"
  • "/mnt/extras" or anything else for "/dev/md2" [this step is optional]
Install everything as you normally would.
Now we mount Slackware (/dev/md0) and the boot partition and chroot into the system
  • mkdir /mnt/md0
  • mount /dev/md0 /mnt/md0
  • mount /dev/sda1 /mnt/md0/boot
  • chroot /dev/md0
Now we are in the OS installed on our software RAID array. Next we mount the Slackware DVD, install and setup GRUB (because i prefer GRUB to LILO ;)
  • mount /dev/cdrom /mnt/cdrom
  • cd /mnt/cdrom/extra/grub
  • installpkg grub*.tgz
  • grub-install --root-directory=/boot /dev/sda # WARNING : GRUB goes into sda's MBR
  • cd /boot/boot/grub
  • touch menu.lst
Create boot entries in menu.lst for GRUB to boot (# nano /boot/boot/grub/menu.lst)
My /boot/boot/grub/menu.lst looks like this :
timeout 10
title Slackware Linux 12.0
root (hd0,0)
kernel /vmlinuz root=/dev/md0 ro
Save & Close.
Just to make sure that fstab mounts the right arrays in the right places, its better to take a look at it is in /etc before we boot into the system (# nano /etc/fstab)
My /etc/fstab looks something like this (Your's probably should look something similar to this ) :
/dev/md0 / ext3 defaults 1 1
/dev/sda1 /boot ext3 defaults 1 2
/dev/md1 /home ext3 defaults 1 1
just type 'exit' to get out of the system and into the DVD, unmount all the drives and reboot.
  • exit
  • umount /dev/sda1
  • umount /dev/md0
  • umount /dev/md1
  • umount /dev/md2
  • reboot
Now if all went well, your Slackware should boot normally that too from a RAID array! ;)
Enjoy !

1 comment:

Roland said...

I am trying to install SLackware 13.0 on raid0 array, but I get stuck on installing GRUB:

root@slackware:/# grub-install --root-directory=/boot /dev/sda
df: Warning: cannot read table of mounted file systems
df: Warning: cannot read table of mounted file systems
Could not find device for /boot/boot: Not found or not a block device.

I googles the error, and found some solutions but can't apply any of them because:
There is no /proc/mounts file
/etc/mtab is empty

Any help?