Building Software RAID

If you do not have any hardware raid controller card then you can build your own software raid using mdadm package in Linux.  Below are the steps.

1. Check RAID Volumes using following command.
RAID-1
The above command show that there is no software raid volume in machine.
The RAID concept says that, you should have independent hard drives so that failures
can be best managed. But for learning purpose, we will use one hard drive in our system with multiple RAID compatible partitions.
2. We have one 10 GB drive /dev/xvdb in our system. We
are now going to create RAID compatible drives in the system using fdisk command as below.Before we move ahead, let me define a scenario for software RAID.Our RAID System will,

a] The volume will be RAID 1 Type Volume

b] There will be three volumes of 500 MB each.

c] The device will be /dev/md0 and will be mounted in /mydisk folder.

Let us start . . .

3.Using fdisk command create 3 drive of 500MB each.
RAID-2.png (26261 bytes)
RAID-3.png (20563 bytes)
4. The newly created drives are having Id as 83, which means they are fixed type of drives. We need to change this to fd as RAID Compatible drives. You can us the t command to change the partition id as below.
RAID-4.png (42804 bytes)
5. Save the changes to MBR using w command  and update the Partition Table to Kernel using partprobe command.
RAID-5.png (6182 bytes)
6. Now you should be able to see following output after running fdisk command.
RAID-6.png (24615 bytes)
7. Now it’s time to create /dev/md0, the RAID-1 Volume. Please make sure that you have package mdadm installed in your machine.
[root@station5 ~]# yum list mdadm
[root@station5 ~]# yum install mdadm -y
Now create volume
RAID-7.png (13398 bytes)
You can check the progress as below
RAID-8.png (11719 bytes)
After completion you should be able to see,
RAID-9.png (41340 bytes)
Your drive /dev/md0 is now ready Now format the drive /dev/md0 and mount the same in /mydisk folder. Below are visual steps.
RAID-10.png (29163 bytes)
RAID-11.png (19808 bytes)
Perfect ! You have successfully created RAID-1 Drive !!