RAID (Redundant Array of Inexpensive Disks)
Raid are basically partitions which allow redundancy, better performance and some advance features.
Main Raid techniques are:
1. RAID 0 (Striping): In this type of Raid, disks are grouped together to form one large drive. This offers better performance at the cost of availability. Should any single disk in the
RAID fail, the entire set of disks becomes unusable. Two disk minimum.
2. RAID 1 (Mirroring): In this type of Raid, disks are copied from one to another, allowing for redundancy.Should one disk fail, the other disk takes over, having an exact copy of
data from the original disk. The downside here is slow write times. Two disk
minimum.
3. RAID 5 (Striping with parity): In this type of Raid, disks are similar to RAID 0 and are joined together to form one large drive. The difference here is that 25% of the disk is used for a parity bit, which allows the disks to be recovered should a single disk fail.
Three disk minimum.
Raids can be implemented either Hardware or Software.
Lets Raid:
The package used for raid in RHEL6 is mdadm
Lets assume we have three drives /dev/sdb /dev/sdc and /dev/sdd and are connected in side the Server or PC
Now to make them Raid 5 we perform the following:
#mdadm --help
-a, xx Adds a disk into a current array
-C, —create Creates a new RAID array
-D, —detail Prints the details of an array
-G, —grow Changes the size or shape of an active array
-f, xx Fails a disk in the array
-l, —level Specifies level (type) of RAID array to create
-n, —raid-devices Specifies the devices in the RAID array
-q, —quiet Species not to show output
-S, —stop Stops an array
-v, —verbose Provides verbose output
So we will use:
#mdadm -Cv /dev/md0 --level=5 -n3 /dev/sdb /dev/sdc /dev/sdd <---
The above command will Create Verbosly level 5 raid with 3 number of disks.
Now to see the Deails of this newly created raid use the below command:
#mdadm -D /dev/md0 <---
To View the Status of this Newly created Raid use the below command:
#cat /proc/mdstat <---
Now in case of a disk failure (lets say its sdd) we need to perform the following tasks:
#mdadm /dev/md0 -r /dev/sdd <---
Now to add the new disk we need two things to keep in mind:
a) Partition the new disk
b) make the disk active
Partition can be done as explained in my earlier post.
To Make the new Raid disk Active we use:
#mdadm /dev/md0 -a /dev/sdd <---
To verify the above use the command:
#mdadm -D /dev/md0 <---
Few useful commands:
In case to take the Raid Array Offline use the command:
#mdadm -vS /dev/md0 <---
To Delete the Raid Array we need to stop it first:
#mdadm -vS /dev/md0 <---
Now to Remove the Raid Array we use:
#mdadm --remove /dev/md0 <---
Very Important must Read:
The /boot partition that contains the files necessary to boot the system can
be located only on a RAID 1 or basic partition. The reason is that the bootloader
(GRUB) understands how to handle only RAID 1 and basic partitions.
If you try to create the /boot partition on a RAID 5 array, you get an error message.