RAID (Redundant Array of Inexpensive Disk) are used to safe data in hard disks by combining them. RAID was developed decades ago for servers when large hard disks were in use and they were very expensive, so the solution was to combine hard drives to create a larger storage capacity.
A special controller is required to create a RAID configuration. Now these controllers are also built-in in motherboard.
Types of RAID:-
By using RAID you can combine two or more hard disks into an array, which can be configured in a number of different ways. Basic which all controllers can do are RAID O and RAID 1.
RAID O improves performance and RAID 1 creates secure storage. We can combine both RAID O and RAID 1. RAID 5 and RAID 6 are more complex to configure.
RAID O – Striping
RAID O or Striping can be used for two or more hard disks to improve performance.Data is written in blocks of a certain size (usually 64 kB), and it’s divided equally across the available drives. The diagram below has a schematic overview of a RAID 0 array with three hard disks. The RAID controller writes the first data block to hard disk 1, the second block to hard disk 2, the third block to hard disk 3, the fourth block to hard disk 1 and so on.
Advantage: The hard disks are accessed simultaneously and the data is spread evenly, so in theory a RAID 0 array with three disks is three times faster than one hard disk. You also keep the entire storage capacity. For example, three 1 TB hard disks in RAID 0 provide 3 TB of storage.
Disadvantage: The main one is if one disk malfunctions, you can’t access any data on any of the other disks. Also, if you have three disks, you are three times more likely to have a disk fail. So it’s fast, but if it the array contains data that’s important to you, you better create frequent back-ups.
RAID 1 – Mirroring
RAID 1 or mirroring is used to create an automatic copy of your data. RAID 1 writes your data to two separate disks, and if one fails, you still have all of your data available on the other one.
Disadvantage: The drawback is that you loose half the capacity. A mirror is not the same as a back-up, but we’ll touch upon that later.
Advantage: The performance in RAID 1 is generally the same as that of separate hard disk. So you don’t use RAID 1 for performance, but to have an extra copy of all your files.
How RAID 1 works:-
RAID 1 is not the same as a back-up. If you accidentally erase a file from one disk, it’s also gone from the other.
There are also RAID configurations where you don’t lose half your storage capacity, such as RAID 3, 5 and 6.
For a RAID 3 array you need at least 3 hard disks, and it works with more as well. In RAID 3 data is written by striping onto all but one of the disks. That one disk stores parity information, which is used to recompile the data when one of the disks fail. So just like RAID 1, RAID 3 offers protection when a disk fails, but you sacrifice much less storage space since you only use one disk for the parity data.
The more disks you have in a RAID 3 array, the smaller the relative portion is that you lose out of your total capacity. A RAID 3 array with three 1 TB hard disks has 2 TB of storage capacity: (3 – 1) x 1 TB = 2 TB. A RAID 3 array with five 1 TB hard disks has 4 TB of storage: (5 – 1) x 1 TB = 4 TB. In the first case you lose 33% of your storage, and in the second only 20%. Both are more appealing than the 50% sacrifice of RAID 1. RAID 3 has another advantage. Like RAID 0 the data is divided over multiple disks, so you also get a performance boost compared to a single hard disk. Writing data goes slower, however, since the parity information has to be created. The illustration below shows how RAID 3 with three disks works.
RAID 5 and 6
RAID 5 uses the same concept as RAID 3, with slightly different implementation. Instead storing parity information on one disk, it’s divided over all disks in the array. In practice it matters very little whether you have RAID 3 or 5, but most recent RAID controllers only offer RAID 5.
In a RAID 5 array one disk can fail and it won’t affect any of your data. If that’s still not safe enough, you can go for RAID 6. Here a different type of parity is written to two disks, and two disks can fail without affecting your data. RAID 6 works with four disks or more, but is usually applied with at least five or more disks. If you only have four disks you might as well go for RAID 1+0.