Configuring RAID1 on Slackware 12.0

This article describes how to configure software RAID1 under Slackware 12.0. This presumes you are installing Slackware 12.0 in a new installation with two identical (or close to identical) capacity drives. This article does not discuss the Slackware installation process, and in fact presumes the reader is familar with it.

This article is based on my own experiences, and references material in a great article written by John Jenkins.

For best performance, ensure the two drives are on separate channels (e.g., if using IDE drives, have them on separate cables).

Start by configuring the desired partitions on the drives using fdisk or cfdisk, which are available on the Slackware installation boot CD after you have logged in as root.

All partitions should be sized as needed, and set to type FD, which is Linux RAID Autodetect. Swap partitions should be set to 82 as with any other installation.

Here is an example using fdisk:

Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1        1216     9767488+  fd  Linux raid autodetect
/dev/hda2            1217        2432     9767520   fd  Linux raid autodetect
/dev/hda3            9484        9729     1975995    5  Extended
/dev/hda4            2433        9483    56637157+  fd  Linux raid autodetect
/dev/hda5            9484        9729     1975963+  82  Linux swap

In this case I was using three partitions on each disk, with a fourth swap partition.

If the second disk is identical to the first, you can use the following command to copy the partition setup to the second disk:

sfdisk -d /dev/hda |sfdisk /dev/hdc

If the second disk is not identical, the capacity must be the same size or greater. You can then manually create the partitions using fdisk or cfdisk. If you are unable to make some of the partitions the exact same size as partitions on the first disk (depending on disk geometry, etc.), then make them slightly larger. The RAID software won’t care, as long as it can mirror the data from the partitions on the first disk into the partitions on the second disk.

Again, as with the first disk, make the partitions of type FD, with the exception of the swap partition.

When this is completed, run the following command to set up RAID:

mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/hd[ac]1
mdadm --create /dev/md1 --level=0 --raid-devices=2 /dev/hd[ac]2
mdadm --create /dev/md2 --level=0 --raid-devices=2 /dev/hd[ac]3

Note that we run one for each partition. Also take note of the fact that only the first partition is set to –level=1, and the others are set to –level=0.

The RAID array now needs to be activated prior to running Slackware’s setup, or else Slackware will complain that there are no partitions available to install on:

mdadm -A /dev/md0 /dev/hda1 /dev/hdc1

Now you can run setup, and you should be able to see and use your partitions.

After setup has completed, there are some other steps that need to be taken prior to rebooting. First, the file mdadm.conf needs to be created. Run the following command to create this file:

mdadm -D --scan >> /mnt/etc/mdadm.conf

You can more | /mnt/etc/mdadm.conf to see what was placed in that file.

The last step is to make the necessary adjustments to lilo.conf.

Run the following commands:

chroot /mnt
vi /etc/lilo.conf

Change the line that has the boot directive so it points at the primary RAID partition:

boot = /dev/md0

Now add the following line, changing it as necessary to reflect your actual drive configuration:

raid-extra-boot = "/dev/hda, /dev/hdc"

Then save and exit the file, and run:

lilo -v

Ignore any warnings. You should now be able to reboot and Slackware should come up as expected.

Further Reading

slackware/mdadm_raid.txt · Last modified: 2007/12/23 11:09 (external edit)
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0