You may have heard the word RAID for so long as you deal with computers. Although this word certainly reminded you of a cockroach, it has nothing to do with preventive computer spraying against cockroaches. In this article we will try to unravel what RAID is and how it is used in computers.
You all, more or less, at some point have lost your data because your precious hard drive has decided to give up its spirit.
But other than the unique photos you lost, there are computers that the logic that they can lose data is not acceptable at all. Organizations, banks, state records, and much more data, you realize can not be lost. The solution of course is backup. And even triple and quadruple Backup of the same data, each of which will be located in different places, even in other cities or countries.
But beyond the backup, a way had to be found to save to the original computer, where if the disk crashes, the recovery time is not huge. That is, the bank should not have to download its systems for one day until the data is copied from a backup, back to the original computer (after someone first changes the hit disk).
Another issue that has preoccupied computer professionals is increasing the speed of writing and reading data on a hard disk. The solution to both issues was provided by RAID. Let's go see.
For the story
The word RAID comes from the initials of the phrase "Redundant Array of Independent Disks", which means "Redundant Array of Independent Disks". In Greece it was established to call it RAID because you simply do not listen to the PSAD pleasantly !. The term "RAID" was coined by him David Patterson, τον Garth A. Gibson and the Randy Katz, at the University of California, Berkeley, in 1987. What did these three think? It is better for both security and speed issues to have an array of hard drives than a large single drive. And in fact, these disks can be very common, cheap disks, the same ones worn on personal computers, which with RAID will perform better than an expensive, hi-tech, single disk.
What is RAID?
RAID is the cooperation technique, the way of communication two or more hard drives so that a stack of disks acts as a single disk, increasing security and speed. And because this can be done in many ways, RAID has several levels.
So we have the levels 0, 1, 2, 3, 4, 5, and 6, which for better communication between us, we call them RAID 0, RAID 1, RAID 2 and so on. The most common levels used almost to the crown are 1, 5 and 6.
We will see the differences between them below, but in general these levels move between safety and speed, and some are close to safety, while others are close to speed. You see, in this life you can not have both together, at least to their fullest extent.
Forgive us for not presenting the various levels in turn, but for the sake of education. Jump RAID 0 and go straight to RAID 1, 5 και 6.
What is RAID 1?
RAID1 is just the faithful and simultaneous copying them from one disc to another. That is, RAID1 is one mirroring (mirroring) and what is written on one disc is automatically written on the other. So if one disk fails the system continues to run smoothly with the second disk without any interruption.
Of course he waits for you to put a new disc in place of the damaged one so that he can start copying himself, or else he can do it. "rebuild”(Reconstruction).
In short, this is the simplest collaboration of two albums and of course it has pros and cons. Look at them.
- Recording speed = RAID 1 writes at the speed of the slowest disk, as the slow disk delays the common, simultaneous recording on both disks.
- Read speed = because it can read from both disks simultaneously and independently, in theory the read speed can be the sum of the speeds of the two disks, since it can read half the data from one disk and the other half from the other.
- Security = we have a permanent backup and only if both disks are damaged at the same time will we lose our data. If one of the two fails, the system does not stop, but continues to provide service using the other disk.
- Capacity = While we have two disks, we can write data according to the capacity of the smallest disk. A big disadvantage since we definitely lose 50% of the total capacity and if one drive is smaller than the other, say 1TB and 750GB, then RAID 1 will see a single 750 GB drive.
- Scalability = Of course we can add a trio and a fourth disc and as many as we want, but they will all be copies of the first and all together will have the capacity and recording speed of the smallest.
In general, however, RAID 1 is a good home solution for a personal computer that will store your data on two different disks at the same time and that one will be a copy of the other and in addition you will increase the reading speed. That is, if you already have two disks and you make a simple backup on the second one, consider the idea of making it RAID1 so that you can have the backup again but also increase the read speed.
RAID1 is not usually available on professional servers, where the demands grow.
What is RAID5?
Almost all servers that have RAID use level 5. The reason? RAID 5 is the golden ratio between safety, speed and capacity.
RAID 5 needs at least 3 disks to work. I'm made so that if you lose one of the three, your data will not be lost.
In RAID 5 the data is written to disks with his technique Striping (strips). Striping is the separation technique sequential data logs, so that these sequential sections are stored on different physical storage devices. Are you confused? In short, break a file into pieces (blocks), usually 64KB, and share these tracks in order on all disks. The 1st track will be saved to disk1, the 2nd to disk2, the 3rd to disk3 and so on. This creates rows of horizontal recordings for aligned discs, as shown below.
The key with RAID 5 is that for each row of blocks stored on disks, a parity block, which is stored on one of your disks. And because the parity technique is common from raid 3 to raid 6, let's make a big parenthesis and analyze it.
The Parity bits technique is based on being able to easily find some lost data, from a damaged disk. After dividing the data into equal parts by the striping method, RAID undertakes to make and register the parity. See exactly what he does.
Although usually in RAID5 a file is broken into 64KB bits, for ease of understanding, let's say we have a file, which in the binary system consists of only 9 bits 0 and 1 (you will probably know that every data in the computer actually consists of a group of numbers 0 and 1, ie reduce to the binary system).
So let's say we have the 9-bit file "010101110" and break them into three equal pieces, ie 010, 101, 110 and save them on 3 disks.
Now comes the parity technique, sees the 3 pieces and makes the following calculations, using it XOR logical function (eXclusive OR).
For those who do not know, the XOR is a logical function that adds 0 and 1 in its own way. From now on, forget the math you knew, and do not call your elementary school teacher to find her, because you think she did not teach you good. It is not a mathematical function but logical function computers (semiconductors to be exact).
XOR, as a result, scores 0, if we add two similar things
XOR (0, 0) = 0
XOR (1, 1) = 0
and respectively yields 1, if we add two dissimilar
XOR (0, 1) = 1
XOR (1, 0) = 1
And so parity reads the data from the first two disks, ie 010 and 101 and calculates the XOR for each corresponding bit. The 1st from the first triad with the 1st from the second. That is, it performs the operations:
XOR (010, 101) = 111
Then he gets the result and again calculates the XOR with the 3rd piece. That is, it performs:
XOR (111, 110) = 001
So the parity of 010, 101, 110 makes us 001. It records this on the next disk of RAID 5. The recordings on all 4 disks, ie 010 | 101 | 110 | 001 we also call it row (series).
Finally the parenthesis with Striping and parity and we return to RAID5. In RAID 5 the data is not divided per 3 Bits but per 64 KB (64KB = 65536 * 8 = 524288 bits). The process and logic remain the same as in the 3 bits.
In an example with 4 disks in total, as soon as one of them crashes, then RAID5 undertakes to do the exact opposite with the above and thus reconstruct the missing data from the damaged disk. When you put a new disk in place of the old one, then RAID 5 with the reverse process discovers the data that the damaged disk had and writes them in place of the new one that you just put, that is, it rebuilds.
If a second drive fails before you can rebiuld the first one, then unfortunately you will lose all your data.
Note that parity is not written to a separate disk of its own, but data and parity are distributed to all disks in a rolling order. And while the logic and calculation of parity blocks is relatively simple, distributing parity blocks across all disks is a more complex matter. There are four different techniques for RAID 5 regarding the location of the parity and if it happens and we change controller, because it can break, we need to know exactly the type of RAID and the order of registration, to recover the data from the new controller .
Let's look for and against RAID 5
- Burn speed = The total write speed is the sum of the speeds of all discs minus one. That is, in an array of 3 + 1 discs we have tripled the recording speed. Somewhere here, of course, comes the quality of the controller that performs RAID 5, since it has to do with how fast it calculates and writes the parity.
- Read speed = The same goes for write speed
- Security = Very good security if you consider that you can have an array of 10 disks and you are not afraid that one of them will be damaged. Provided only one disk is damaged, until you have time to rebuild your system with a new disk. If you do not catch and a second one breaks down, then all the data from all 10 disks will be lost !!. Rebuilding a disk requires reading all the data from all the disks, opening up a possibility of a second disk failure and the loss of all data.
- Capacity = Because the data is evenly distributed across all disks, the capacity will be equal to the capacity of the smallest disk on all minuses. That is, if we have 1 750 GB disk and 3 1 TB disks then the total capacity of RAID 5 will be (4-1) * 750GB = 2,25TB. In proportion, with 3 identical disks in the array, the third is lost as parity, so we lose 33% of the total. The more discs we add the lower this percentage.
- Scalability = Of course we can add a trio and a fourth disc and as many as we want, but if two of them spoil together, then we lose our data. Even if we have 50 records, we should not spoil two together.
What is RAID 6?
Security above all. RAID6 is the same as the previous RAID5, except that instead of one parity it has two parity blocks. Dual parity provides error tolerance for up to two inadequate disks. That is, our system will be functional even if we lose 2 disks.
This is more practical for RAID groups that carry a lot of small disks, especially if we are talking about high availability systems, as large capacity drives need more time to recover. RAID 6 requires at least four disks. As with RAID 5, a drive failure results in reduced performance of the entire array until the failed drive is replaced. In tests we did earlier with RAID 5 software, a 1TB disk took about 4-5 hours to rebuild.
With a RAID 6 array, using drives from multiple sources and manufacturers, it is possible to alleviate most of the problems associated with RAID 5. The probability of 3 disks crashing together is clearly much lower than the risk of crashing 2, which would was a problem in RAID 5.
The second parity is not just a copy of the first. Instead it is recalculated, using a different method from XOR, called Finite field or Galois field and it has to do with field theory and quite complex mathematics. But since the article is aimed at beginners, it is better not to get involved in explaining this method. At least keep you sober until the end of the article.
Let's see here the pros and cons:
- Recording speed = Recording, due to the additional complexity of calculating parity, depends to a large extent on the controller. At best it will be equal to the sum of the speeds of the total disks minus two.
- Read speed = The speed of RAID 6 in reading, reaches the maximum as the sum of the speed of all disks minus two.
- Security = Much better security than its main competitor, RAID 5. The chance of three disks crashing and losing data is minimized. Besides, RAID6 is famous for its good operation, in multi-disk arrays. Consider that the more disks, the more likely it is that two of them will be damaged at the same time. Whenever RAID 6 in this matter is one way.
- Capacity = Total capacity is the size of the smallest disk on the numbers of all disks minus two. That is, if we have 1 of 750GB, 2 of 1TB and 1 of 1,5TB, then the total capacity will be 750 * (4-2) = 1,5 TB.
- Extensibility = In a RAID 6 array we can add as many disks as we want.
What are RAID 1E, 5E, 5EE, 6E
These are the RAIDs you know so far, only they have an empty backup disk. That is why they call it E, from “Enhanced”(Enhanced).
When a disk in these RAIDs breaks down then our system is in danger. This disk should be replaced as soon as possible and then the whole system rebuilt. But until all this is done, you were in real danger of destroying a second drive (or even 3rd for raid 6) and losing all your data.
So they put a spare blank disk in the array, where you sit and wait and they call it Hot-Spare. If a disk breaks down, the backup automatically starts up and rebuilds immediately, without wasting time until a technician discovers it. Especially during holidays and vacations.
In RAID 1E you have 1 regular disk, a mirroing disk and a third separate disk as a backup. In RAID 5E the hot-spare disk is distributed as part of the set of disks, in pieces placed at the end of each disk. Creating 5E requires at least 4 disks in total.
The 5EE differs from the 5E in the position of the spare disk in the array and in the overall operation. In 5E the backup disk is placed in the last position while in 5EE it is placed in between and participates in the operation of RAID by increasing the levels of the array by one more. This reduces rebuild time.
There are many critics of Hot-Spare and the possibility of an automatic rebuild. Because, as we said above, rebuilding a table requires reading all the data from all the disks, opening up a possibility of a second disk failure and losing all the data, they believe that before the rebuild starts, it should be checked first. by a technician.
Being aware of Murphy's Law, no one would risk immediate rebuilding after a disk failure, and using a Hot-Spare this is exactly what will happen.
What is RAID0?
Maximum speed and not safety. RAID 0 is a clean striping without any parity. It takes at least two disks and the data is divided into blocks, which are written in sections on all the disks that make up the array. If you have four disks, instead of having to wait for the system to write 256k of data to one disk, a RAID0 system can write 64k simultaneously to each of the four disks in an array, providing excellent I / O performance.
Do you realize that if even one disk is lost then all the data is lost !!!. RAID0 is only recommended for situations where you are interested in speed and not at all the possibility of losing data, for example in RAID0 you can write your operating system and on a separate disk, regardless of RAID you only have your data.
Pros and cons:
- Burn speed = It is the sum of the burning speeds of all discs.
- Read Speed = It is the sum of the read speeds of all disks.
- Security = Zero! If you lose a disk, which at some point you will lose, then you will lose all data and you will have to rebuild everything from the beginning.
- Capacity = Total capacity is the size of the smallest disk on the numbers of all disks. That is, if we have 1 of 750GB, 2 of 1TB and 1 of 1,5TB, then the total capacity will be 750 * 4 = 3,0 TB.
- Extensibility = In a RAID0 array we can add as many disks as we want.
What you need to remember
- RAID was created because of the need for speed, security in data corruption, and minimizing downtime.
- The most common RAIDs are 1, 5 and 6.
- Striping is the splitting of a file into pieces on multiple disks.
- Parity is the technology that can reconstruct lost data.
- XOR is a logical function
- RAID0 only offers speed, without any security.
- RAID1 is simple mirroring. Good for home computers
- RAID5 is striping with a parity. The golden ratio in speed and safety and capacity.
- RAID6 is striping with two parities. Focus on security.
- Hot-Spare, or simply the E at the end of the name, is an additional backup disk.
Making RAID combinations
If you have imagination and creativity, then you can marry all of the above, aiming for the best solution for your needs. With the logic that a RAID in the end looks like a single disk, nothing prevents you from combining different RAIDs together. You can make RAID 10, 01, 50, 60, 100.
We are telling you that RAID01 is two RAID0 arrays, one copied to the other with RAID1. That is, we have two RAID0 mirroring. It requires at least 4 disks and each RAID0 has twice the write and read speed of a single disk, and because they are in RAID 1 between them, the total theoretical speed is at least four times. Of course security follows the logic of RAID1
Just the opposite from 01, but more popular than the previous one. We have two arrays with RAID1 that we put and they do striping like RAID0. This device allows up to two disks to fail, as long as they are on different RAID1s. If a third drive fails, wherever it is located, then all data is lost. In terms of speed, it also applies to RAID01, ie the maximum quadruple.
These are two arrays with RAID5 that we put to work together like two disks with a RAID0. Requires at least six disks. It can lose a maximum of one drive from each RAID5 array and speeds are twice that of RAID5, a total of four.
The same as above. We have two arrays with RAID6 and we put them to work together like RAID0. Requires at least eight disks.
If you have more than eight discs and you like lego, then make four RAID1s, put them striped in RAID0 and re-striped the result with another RAID0. However, your friends will need a lot of time to understand what you did.
What are RAID2, 3 and 4?
Just as you imagined there are three other RAIDs, RAID2, RAID3 and RAID4. We do not think you will find them anywhere after they have been abandoned. The history of RAID states that in the beginning only RAID 1 and RAID2 appeared. Later, depending on the needs of each developer and company, the rest appeared, and not necessarily all together. And yes, RAID0 did not appear first, but later than 1 and 2.
After various "experiments" only 0, 1, 5, and 6 remained and all the rest were abandoned. However, in order to be globally aware, we say:
In the case of RAID 2, all data is striped at the bit level and not at the block level, like everything else. Each bit is written to a different disk / strip. Such a solution requires the use of the Hamming Error Correction Code (ECC) to correct the errors.
Essentially the first bit was written the first bit, the second the second, and so on. The number of disks in RAID 2 used to store information is equal to the logarithm of the number of disks that protect the reported data. That is, it uses many more disks for ECC and for example for 10 data disks it wants 4 disks for ECC or another example for 4 data disks requires 3 disks for ECC.
In RAID2 the controller tunes the disks to spin at the same speed. RAID2 is no longer used as a solution. It is considered expensive because it requires extra disks and its implementation is complicated as it requires the use of Hamming code, which is now integrated into modern hard drives.
RAID3 went one step further than RAID2 as it strips to 8 bits (ie in one byte) and thus does not require many disks for ECC, but only one disk, dedicated exclusively for parity. Requires disks to rotate at the same speed.
The problem with RAID3, as with RAID2, is that the required disk synchronization performs well in sequential read / write, but if you give it too many requests at once, the speed will drop dramatically. That is, random read / write has a worse performance and so is usually not used.
RAID4 stripes not byte like RAID3, but at the block level (16, 32, 64 or 128 kB). Like RAID 5. But for parity it uses an exclusive disc only for this job, just like RAID 3. Exclusive use of a single disc for Parity only reduces the write speed and finally with the advent of RAID5, RAID3 and 4 were abandoned.
Now as far as the controllers that perform RAID are concerned, there are the hardware and the software, with each one having pros and cons. We will analyze them in a different article, since up to here you have, your head probably hurts.