/>How to create a Raid Device using madadm in linux rhel5
with level 5, 0 and 1
The following article explains what is Raid, what are important levels and how to install and
configure a raid device in a linux system using the software mdadm. This is tested in Redhat
rhel5 and also works with other distributions as fedora, centos etc.
What is RAID?
RAID is redundant array of independent or inexpensive disks. It is mainly used for data
protection. It protects our data storage from failures and data loss. All storage units now use
raid technology.
It has following uses.
1. Data protection
2. Increasing performance
Types of RAIDs:
There are alot of levels of RAIDs. But the main levels are
1. Level 0 or Striping
2. Level 1 or Mirroring
3. Level 5 or Striping + Parity
Level 0:
It is also known as striping. You know hard disk is a block device. Datas are read and written
from/to it by blocks.
Suppose we have data block as below
1 0 1 1
Suppose each bit takes one cpu clock cycles for writing into a disk. Total, it will take 4 cpu
clock cycles.
With stripping:
In striping we use "N" number of hard disks. RAID devides the data block by "N" and writes
each part to each disk in parallel.
If we have 4 hard disks, It'll take only one cpu clock cycle if we use Level 0 RAID.
Raid 0 is best for where more writing take place than reading. But is insecure as there is no
recovery mechanisms.
Level 1:
by failing or deleting any partition it consists of.
touch something in /raid5 and delete one of partitions of sda5,sda6,sda7
This is how we can create a Raid device with level 1
***RAID 1***
#mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda{5,6}
This is how we can create a Raid device with level 0
***RAID 0***
#mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sda{5,6}
Stopping mdadm
*Unmount the md0 before stopping mdadm
#mdadm --stop /dev/md0
If you want to create additional devices[ie there exists a /dev/md0] you may need to add an "-
a yes" option to the mdadm command.
For example,
#mdadm --create /dev/md1 -a yes --level=0 --raid-devices=2 /dev/sda{5,6}