This is an old revision of the document!
http://wiki.centos.org/HowTos/SoftwareRAIDonCentOS5 http://wiki.xtronics.com/index.php/Raid http://robbat2.livejournal.com/231207.html https://raid.wiki.kernel.org/index.php/Linux_Raid http://archive.networknewz.com/2003/0113.html
Works on block devices, usually partitions. This is not like strictly-drive-oriented hardware RAID controllers.
Show Existing RAID
mdadm –detail –scan
Partitioning
fdisk /dev/sda
Using fdisk, create matching partitions on various drives (block devices) of type “fd Linux raid autodetect” that will be assembled into arrays.
sfdisk -l /dev/sda
Disk /dev/sda
: 8942 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System
/dev/sda1
* 0+ 242 243- 1951866 fd Linux raid autodetect
/dev/sda2
243 485 243 1951897+ fd Linux raid autodetect
/dev/sda3
486 607 122 979965 82 Linux swap
Once you partition the first drive, use sfdisk to duplicate partitions from that first drive to other drives:
sfdisk -d /dev/sda
| sfdisk /dev/sd[b
cd]
Create Arrays
http://robbat2.livejournal.com/231207.html http://en.wikipedia.org/wiki/Mdadm
mdadm –create <array_device> -c <chunk_size> -l <raid_level> -n <active_disks> -x <spare_disks> <block_devices>
Here is a four-drive RAID5 example where one drive is a hot spare. Hot spare drives can serve multiple arrays (spare-group).
mdadm –create /dev/md0 –level=5 –raid-devices=3 –spare-devices=1 –spare-group=groupname /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
http://www.kernelhardware.org/linux-add-share-hot-spare-device-software-raid/
Add a Drive
mdadm –detail –scan
mdadm –add /dev/md0 /dev/sdb1 mdadm –add /dev/md1 /dev/sdb2 mdadm –add /dev/md2 /dev/sdb3
Create Conf FIle
mdadm –detail –scan > /etc/mdadm/mdadm.conf
or (Centos)
mdadm –detail –scan –verbose > /etc/mdadm.conf
Last changed (in Tomboy): 2011-05-02 Note created (in Tomboy): 2010-12-18