Disk managements

A Redundant Array of Independent Disks (RAID) is a series of disks that can save your data even if a terrible failure occurs on one of the disks. While some versions of RAID make complete copies of your data, others use the so-called parity bit to allow your computer to rebuild the data on lost disks

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

 #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

 #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.