Software RAID


Necessary Software

Install raidtools and mdadm, plus make sure the kernel has RAID support and that all necessary disk/IDE/SATA driver modules are loaded first. Also need fdisk and mke2fs.

Sample /etc/raidtab and /etc/fstab entry

For a simple RAID-1 array. Note that both drives need to be type "fd" in fdisk for type "Linux raid autodetect". To do this, run fdisk on /dev/sdb, /dev/sdc, etc.

bash-2.05b$ cat /etc/raidtab
raiddev /dev/md0
     raid-level 1
     nr-raid-disks      2
     nr-spare-disks     0
     chunk-size 32
     persistent-superblock      1
     device     /dev/sdb1
     raid-disk  0
     device     /dev/sdc1
     raid-disk  1

For /etc/fstab, add a line like:
/dev/md0                /home/public    ext3            defaults                1 2

The /dev/md0 will need to be formatted as any other drive would be using mke2fs.

When drives fail or get lost (example: add /dev/sdc1 to array)

raidhotadd /dev/md0 /dev/sdc1
and wait a very long time to resync the array.

To Find RAID status


A good 2-disk array with both drives up has "UU". If one is down it will be '-'.
cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid5] [multipath] [raid6] [raid10] 
md0 : active raid1 sdc1[1] sdb1[0]
      156288256 blocks [2/2] [UU]

unused devices: