Adding Software RAID under Linux
Note: The following instructions and examples are for taking 2 hard drives and creating 2 RAID-1 arrays. Please adjust your command accordingly.
- Make sure that the Linux can see the disks
- Install mdadm
yum install mdadm
- Partition each disk into the required sizes. That is, if you plan to have the array create 2 arrays, you will need to partition EACH drive into two. Make sure the drive partitions are of equal size.
# fdisk /dev/sda # fdisk /dev/sdb
- Change the system type (a.k.a. system id) of each partition to be 0xFD (Linux RAID auto-detect). Make sure you write the changes to the partition table
# fdisk /dev/sda # fdisk /dev/sdb
- Create the arrays.
# mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1 # mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sda2 /dev/sdb2
- Create the filesystems.
# mke2fs /dev/md0 # mke2fs /dev/md1
- Reboot the system to check that the arrays are started at boot-time.
