How to configure RAID5 in Linux

What is RAID????

RAID stands for Redundant Array of Inexpensive Disks. 
This is a solution where several physical hard disks (One+) are governed by a unit called RAID controller, which turns them into a single, cohesive data storage block.
An example of a RAID configuration would be to take two hard disks, each 1TB in size, and RAID them into a single unit 2TB in size. Another example of RAID would be to take these two disks and write data to each, creating two identical copies of everything.
RAID controllers can be implemented in hardware, which makes the RAID completely transparent to the operating systems running on top of these disks, or it can be implemented in software, which is the case we are interested in.


 ADVANTAGES OF RAID5

  • READ Data Transaction rate of RAID 5 is very fast.
  • RAID-5 have capacity to change the number of devices.
  • It is also capable of changing the size of individual devices.
  • RAID5 can also change the chunk size.
  • It is also capable of changing the layout.
  • WRITE Data Transaction rate is a bit slow because of the parity involved.
  • You can get the redundancy without wasting any disk.
  • We can also convert A 2-drive RAID5  to RAID1 & A 3 or more Drive RAID5 to RAID6.
  • A 4-drive RAID5 can be easily converted to A 6-drive RAID6 if you have 4-drive.
 DISADVANTAGES OF RAID5
  • Raid 5 is a little bit complex due to its configuration and parity
  • Rebuilding takes time because of parity calculation involved in raid.
  • if suppose one disk fails, the data from that disk is calculated with the help of data from other disk as well as parity from other disks, due to which reading becomes slow .
RAID allows an administrator to form an array of several hard drives into one logical drive recognized as one drive by the operating system. It also spreads the data stored over the array of drives to decrease disk access time and accomplish data redundancy. The data redundancy can be used to recover data should one of the hard drives in the array crash.

RAID level 0, or striping,

Means that data is written across all hard drives in the array to accomplish the fast disk performance. No redundancy is used, so the size of the logical RAID drive is equal to the size of all the hard drives in the array. Because there is no redundancy, recovering data from a hard drive crash is not possible through RAID.

RAID level 1, or mirroring,

Means that all data is written to each disk in the array, accomplishing redundancy. The data is “mirrored” on a second drive. This allows for easy recovery should a disk fail. However, it does mean that, for example, if there are two disks in the array, the size for the logical disk is size of the smaller of the two disks because data must be mirrored to the second disk.

RAID level 5

Combines striping and parity. Data is written across all disks as in RAID 0, but parity data is also written to one of the disks. Should a hard drive failure occur, this parity data can be used to recover the data from the failed drive, including while the data is being accessed and the drive is still missing from the array.

RAID level 6

Data is written across all disks as in RAID 5, but two sets of parity data is calculated. Performance is slightly worse than RAID 5 because the extra parity data must be calculated and written to disk. RAID 5 allows for recovery using the parity data if only one drive in the array fails. Because of the dual parity, RAID 6 allows for recovery from the failure of up to two drives in the array.
In real life we never create raid on same hard disk. But its exam and examiner is not going to provide you three separate hard disk so you should be able to create three raid partition on same physical hard disk.
To create raid partition we will use fdisk utility.
Execute fdisk command with -l switch it will show hard disk mount point
[root@localhost`]# fdisk -l

Check the output for hard disk mount point. Use that mount point with fdisk command. My hard disk is mounted in /dev/sda so I am using it with fdisk command. If output of above command is different for you then use that mount point. you should use the proper hard disk option whatever you receive in the output of above command, for example it could be hdd sdb
 [root@localhost`]# fdisk /dev/sda
Create a new partition and assign file type to raid
Command (m for help)n
First cylinder (1543-2610, deaults 1543):
press enter Using deafults value 1543 Last cylender ..............): +100M
linux fdisk commmad create new raid partitions

Now create two more partition repeating the same process don't forget to save with w command.

linux raid partitions
Inform kernel about this change by partprobe commands and verify with fdisk -l commands


fdisk -l linux commands
Okey now you have 3 raid partitions and Linux will treat these partition same as three physical hard disks. You can create raid device with these partitions
Create raid 5 device with these partitions
create raid devices
Now format this newly created md0 raid device

mke2fs linux commands
To use this device you must have specify mount point. we are going to use this raid device on /data directory. So create a /data directory and mount md0 on it.

mount Linux commands
This way will mount temporary. To permanently mount make its entry in /etc/fstab file.

fstab Linux files

At this point you have successfully created a raid device md0 and permanently mounted it on /data. In our next article we would add new hard disk in raid device and remove faulty media from raid devices.

Using cat /proc/mdstat is the fastest, simplest indication of the health and status of the RAID arrays. If there are no RAID arrays on the system, the output of the command would return output like this:

[root@sujeet~]# cat /proc/mdstat 

Personalities :unused devices: <none>

Removing a RAID Device

To remove an existing RAID device, first deactivate it by running the following command as root:
mdadm --stop raid_device
Once deactivated, remove the RAID device itself:
mdadm --remove raid_device
Finally, zero super blocks on all devices that were associated with the particular array:
mdadm --zero-superblock component_device
Example 6.5. Removing a RAID device
Assume the system has an active RAID device, /dev/md3, with the following layout .
~]# mdadm --detail /dev/md3 | tail -n 4
    Number   Major   Minor   RaidDevice State
       0       8        1        0      active sync   /dev/sda1
       1       8       17        1      active sync   /dev/sdb1
       2       8       33        2      active sync   /dev/sdc1
In order to remove this device, first stop it by typing the following at a shell prompt:
~]# mdadm --stop /dev/md3
mdadm: stopped /dev/md3
Once stopped, you can remove the /dev/md3 device by running the following command:
~]# mdadm --remove /dev/md3
Finally, to remove the super blocks from all associated devices, type:
~]# mdadm --zero-superblock /dev/sda1 /dev/sdb1 /dev/sdc1

No comments:

SHRD0014: GLLEZL - process exiting with failure

  SYMPTOMS Journal Import completes with the following error: Error ------ ORA-01653 : unable to extend table GL.GL_IMPORT_REFERENCES ORA-01...