Slackware 9.1 & 10.1 on software raid-1 : HOWTO

6th May 2006, version 1.5

© David Fletcher

The original of this document can be found at:

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:

  1. Boot from the install cd. I found the "bare.i" kernel did everything I needed
  2. 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.

  3. Create the file /etc/raidtab using vi, or copy it in from a floppy or CD (see below). Typical contents of this file are:
    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 1
    for as many raid devices as you want to create.
  4. Ensure there are enough raid device files in /dev. Four are present by default, but you can create more using
    mknod /dev/md4 b 9 4
    mknod /dev/md5 b 9 5
  5. Start the first raid device using
    mkraid /dev/md0
    and 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.
  6. Check progress by looking at /proc/mdstat using "more".
  7. Copy /etc/raditab to a floppy now. You will loose it if you switch off at this stage since it is on a ram drive.
  8. 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.

  9. You can now start "setup" as usual, but you will find it is slow if you don't wait for all the raid discs to finish synchronising.
  10. Go through setup as normal, but note that you can't set up a swap partition yet - you will get an error about not having partition marked as swap. Just ignore this and set up the swap partition later.
  11. When you are asked about setting up Lilo, choose "skip". You need to add some special lines to lilo.conf, which setup can't cope with.
  12. Exit setup, but don't reboot yet! First, copy /etc/raidtab to /mnt/etc/raidtab
  13. Also before rebooting, set up the swap partition. If you plan to use /dev/md1 for swap, type
    mkswap -c /dev/md1
    This includes checking for bad blocks, so it is quite slow.
  14. To ensure swap works the next time you boot up, edit /mnt/etc/fstab to add this line:
    /dev/md1   swap   swap   defaults 0 0
    where /dev/md1 is the raid device on which you have set-up swap.
  15. 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
    timeout = 50
    vga = normal
    image = /boot/vmlinuz
      root = /dev/md3
      label = linux
    This 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.conf
    An 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 disk
    can be ignored - they are just for information.
  16. Now take out the setup cd and reboot. The system should start-up from the hard disc. You can check the raid devices by reading /proc/mdstat


  1. 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:

    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.

  2. Nick Coons from RedSeven Computer Co ( let me know on 28th Aug 2005 of a mistake in the lilo command line which is hopefully now correct, but things otherwise went well on Slackware 10.1. The lilo command previously read lilo -r /mnt/ /mnt/etc/lilo.conf
  3. 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
  4. 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.