Linux Box Admin
Trusted Remote Administration
logo

Tilde
What's new
Articles
Micro HowTos
About
Contact







Software RAID
(1 vote)
Wednesday, 07 March 2007
  Software RAID

The Linux kernel has native soft RAID capabilities, though I recommend using a hardware RAID controller when possible. When raid devices are created, they appear to the system as /dev/mdX where X=0-12. Once they are created, they act like any other device to the system and the RAID happens in the background.

The first step to creating a RAID device is to define it in the RAID configuration file, /etc/raidtab. Here is a sample configuration for RAID1 (mirroring) using two IDE disks:

        raiddev /dev/md0
            raid-level 1
            nr-raid-disks 2
            persistent-superblock 0
            chunk-size 8

            device /dev/hda1
            raid-disk 0
            device /dev/hdb1
            raid-disk 1
Here is a sample configuration for RAID5 (striping with parity) using three SCSI disks:
        raiddev /dev/md1
            raid-level 5
            nr-raid-disks 3
            nr-spare-disks 1
            persistent-superblock 1
            parity-algorithm left-symmetric

            device /dev/sda1
            raid-disk 0
            device /dev/sdb1
            raid-disk 1
            device /dev/sdc1
            raid-disk 2
            device /dev/sdd1
            spare-disk 0

Once the raidtab is defined, use mkraid to initialize and create the RAID sets. Caution: it is destructive to any data on the devices used.

To start all RAID devices in /etc/raidtab:

raidstart -a

To stop a RAID device:

raidstop /dev/mdX


Most distributions start all defined RAID devices at boot time. In Red Hat Enterprise Linux, RAID devices are started from the /etc/rc.d/rc.sysinit boot script.

 

Copyright © 2006,2007 Linux Box Admin.

 
My NHL fan blog