6th May 2006, version 1.5
© David Fletcher
The original of this document can be found at: www.megapico.co.uk/linuxdocs/slackware_raid.html
If you have updates or suggestions for this document, please send them to "linuxdocs at megapico dot co dot uk"
Latest updates are at the bottom
Installing Slackware with software raid-1 is surprisingly easy to do - once you know how! Although the installer doesn't do everything for you like some other distributions, there are only a few extra steps required relative to a standard Slackware install.
I assume that you have two identical ide hard drives, one each on the primary and secondary controllers. I'll also assume that you don't have any data you want to keep on these drives, and that you are installing using a Slackware CD.
The steps are:
Log in as root and use fdisk to partition both drives in exactly the same way. Set all the partitions to type "fd" (linux raid auto-detect) except for any extended partitions, which should be left as type "linux extended".
Set the active or bootable partition on both drives to whichever partition contacts /boot.
raiddev /dev/md0 raid-level 1 chunk-size 64k persistent-superblock 1 nr-raid-disks 2 device /dev/hda1 raid-disk 0 device /dev/hdb1 raid-disk 1 raiddev /dev/md1 raid-level 1 chunk-size 64k persistent-superblock 1 nr-raid-disks 2 device /dev/hda5 raid-disk 0 device /dev/hdb5 raid-disk 1for as many raid devices as you want to create.
mknod /dev/md4 b 9 4 mknod /dev/md5 b 9 5etc.
mkraid /dev/md0and repeat for the higher numbered ones. If you have data on the discs which you want to keep, ensure it is on the first disc of each pair as defined in /etc/raidtab. If you need to, try --really-force to wipe filesystems on the second drive of each pair.
If you want to use tagfiles to set-up the system automatically (perhaps if setting up several identical systems) this can be done easily if you have a floppy which can be mounted to read the files. You can also copy in /etc/raidtab and /etc/lilo.conf if you have them already written (see above).
For a system without a floppy I found that a USB flash drive is not supported by the installation CD, but a CD with the required files can be mounted and read before typing "setup". If the CD is /dev/hdc use:
mount /dev/hdc /var/log/mount
and then copy the files you want. Remember that with the exception of directories below /mnt which are the hard drive partitions onto which the installation will take place, you are copying to a filesystem which exists only in RAM. Don't turn the machine off until the installation is completed! Finish off with
umount /dev/hdc
and put the installation CD back in the drive.
mkswap -c /dev/md1This includes checking for bad blocks, so it is quite slow.
/dev/md1 swap swap defaults 0 0where /dev/md1 is the raid device on which you have set-up swap.
Now install lilo using a lilo.conf file of the type shown below. This file can be created with vi as /mnt/etc/lilo.conf. The example assumes that that the root of the filesystem is on /dev/md3, and that /boot is on /dev/md0, and that the two discs making up the raid are /dev/hda and /dev/hdc.
The "raid-extra-boot" line ensures that both discs of the raid pair have boot code placed on them, so if either fails the system should still boot. However, if the usual start-up disc is the one which fails, you might need to manually set the bios to boot from the remaining good disc.
boot = /dev/md0 raid-extra-boot="/dev/hda,/dev/hdc" timeout = 50 vga = normal image = /boot/vmlinuz root = /dev/md3 label = linux read-onlyThis needs to be installed using the lilo -r option because the filesystem which will be the root is mounted under /mnt during setup.
lilo -r /mnt/ -C /etc/lilo.confAn alternative that seems to work is just to copy the file you have edited from /mnt/etc/lilo.conf to /etc/lilo.conf and then run lilo without any options. To try out what lilo is going to do use options -t -v to do a test run without really writing to the disc. Any warnings like
Warning: dev/hdc is not on the first diskcan be ignored - they are just for information.
Steve Husted in West Sacramento, CA, USA contacted me to say that these instructions work on Slackware Current 23rd December 2004 (pretty much equates to Slackware 10.1) on a board with an Intel 865G chipset with 2 Maxtor SATA drives.
Steve also passed on some links to more information at:
http://www.oxnardcollege.edu/it/howto/slacksoftraid.asp
http://slacksite.com/slackware/raid.html
A complication of Serial ATA with the Slackware installation is that the 2.4 kernel series doesn't seem to support SATA as well as the 2.6, (e.g. the ICH5 I/O controller gets stuck in PIO mode) but the installation is currently designed to use the 2.4 kernel. As of Jan 2005 you need to decide if a post-install upgrade to the 2.6 series will be stable enough for you, otherwise use SCSI or traditional ATA hardware. If using SCSI, remember to replace the bare.i krenel image with adaptec.s, or whichever corresponds to your SCSI card.
Steve found out the hard way that while you can build a RAID 0, 1, 5, or span, you can't BOOT to anything but RAID1.
Installation onto SCSI discs. I found a problem with installation into SCSI discs connected to the Adaptec AIC7892 controller in an IBM x330 server. I don't know if the problem is general to all SCSI controllers, but it is worth noting here.
Although the partition on which lilo was installed (/dev/sda1) was set 'active' using fdisk, and the SCSI bios was set to boot from the disc, the system would not boot. Installing lilo onto the Master Boot Record (MBR) rather than a partition of the drive solved the problem. This required using the line below in lilo.conf:
boot = /dev/sda
Some experiments with 'raid-extra-boot = mbr' might also be useful. I'll add details here which they are available.
Neither the author nor the distributors, or any other contributor of this HOWTO are in any way responsible for physical, financial, moral or any other type of damage incurred by following the suggestions in this text.