Linux Software Raid

Setting up Software RAID on CentOS 6

Configure your disks into a RAID array during installation

You can use the graphical utility during installation to create a software RAID

Using mdadm to create a RAID-1

We have just added two hard disks, and upon reboot we see them in dmesg (sdb and sdc).

First thing we need to do is partition the hard disks.

fdisk /dev/sdb

In here, hit

We want the identical second disk to have the same partition layout, this can be done with sfdisk.

sfdisk -d /dev/sdb > sdb.partinfo.out && sfdisk /dev/sdc < sdb.partinfo.out && rm -f sdb.partinfo.out

Now that we have the two added hard disks partitioned, we can create a raid device and add these 2 partitions using the mdadm utility.

mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1

At this point /dev/md0 is a RAID-1 mirror of the two new hard disks. You can format /dev/md0 and mount it.

mke2fs -j /dev/md0 && mount /dev/md0 /mnt