RAID
In this video from ITFreeTraining I will be looking at RAID. RAID allows multiple storage devices to be combined together to increase performance, add redundancy or both. In your IT career you will more than likely come across RAID, particularly when working with servers, so it is important to understand how it works.
RAID
RAID stands for Redundant Array of Inexpensive Disks. Originally it was designed for hard disks, but nowadays can used for other devices such as Solid-State Drives. For this reason, you may also hear it referred to as devices.
In some cases, you may also hear it referred to as Redundant Array of Independent Devices. Regardless of what you call it, RAID was historically implemented for redundancy or performance. In some of the more recent implementations, both redundancy and performance are implemented.
Given RAID supports redundancy, businesses use it to protect their most important data. To understand how it works, consider that you have a number of different hard disks. These hard disks are combined together to essentially form one storage unit. The data is than broken into blocks and stored on the hard disks. How this data is stored is dependent on which RAID is used. If the RAID supports redundancy, the data will be duplicated, so if a hard disk was to fail it can be recovered. Also, given that data is spread out over the hard disks, it gives performance increases, since multiple hard disks are working at the same time to provide the data.
RAID was originally developed back in the 1980’s. There were many different versions of RAID referred to as levels. Not all the levels of RAID are used, and this video will go through the more common ones.
If your RAID has redundancy, a hard disk can fail and be replaced with no downtime. This is important for businesses, because often the data and downtime is worth more than the equipment itself. If you have 100 people connected to the same server and it fails, that is 100 people who can no longer work. Of course, you could keep a backup of the data, but if you have 100 people waiting for their data to be restored, they may as well take the rest of the day off and come back tomorrow. You can see why RAID for reliability alone pays for itself.
Before I start looking at the different types of RAID, you first need to decide if you are going to use software or hardware RAID.
Software vs Hardware
There are advantages to both software and hardware RAID; however, when given the choice I would always go for hardware RAID. Software RAID requires, as the name suggests, software to work. In many cases, this translates into part of the operating system needing to boot before the RAID can be used. For this reason, booting the OS from software RAID may not be possible. If it is possible, all the features may not be available while the operating system is initially starting. For example, if the drive is mirrored, which I will cover later in the video. Essentially, if the contents of the drive are duplicated to a second drive, during booting the operating system will only be able to access the first drive. Once enough of the operating system has booted, the second drive will be able to be accessed. RAIDs that have data fragmented between drives will not be accessible until the operating system has booted.
By contrast, hardware RAID will be able to boot the OS regardless of how the RAID is setup. Software RAID is generally not as fast as hardware RAID. Hardware RAID will also perform the required processing itself, whereas software RAID will require the CPU to perform this processing. Given how fast computers are nowadays, it is not that much of a load, but it is still an extra load on your system.
Software RAID is included with the operating system, so there is no extra cost. With hardware RAID, there may be additional costs. You will find that most motherboards on the market nowadays have RAID support. Depending on the motherboard, this may be hardware RAID or it may be software RAID. If you spend more money, you can add a hardware RAID expansion card which may provide more features than what the motherboard offers.
Although hardware RAID, in my opinion, is better than software RAID, software RAID currently does have one advantage over hardware RAID. That is, it supports the feature “Trim”, which is used with Solid-State Drives. Trim is a feature that allows the operating system to communicate with the Solid-State Drive, informing it which blocks of data it no longer needs. This helps with the efficiency of the drive, meaning it won’t wear out as quickly.
Hardware RAID support for Solid-State Drives is improving. Some RAID solutions do have Trim support, so if you are planning to use Solid-State Drives in a RAID, I would check to see what it supports. Generally, it is not recommended to use RAID for Solid-State Drives. Solid-State Drives are very fast to start with. If you need additional speed, I would personally recommend spending more on getting a faster Solid-State Drive. You will also find that when you get to the higher speeds, other components inside the computer start slowing things down and thus the speed increase is not that noticeable. If you do decide you want to use Solid-State Drives for RAID, I would suggest doing your research first, so you know what you are getting yourself into.
I will now have a look at the different ways that RAID can be configured.
RAID 0 (Stripping)
To start with I will look at RAID 0 otherwise known as “striping” as it fragments the data over multiple drives. In order to use RAID 0, you require at least two storage devices. Regardless of which RAID you use, referred to as levels, it is best to use storage devices that are identical. If you use different types of devices, this will affect performance and if they are of different sizes it will also result in capacity that is not able to be used for the RAID array.
The big advantage of RAID 0 is that multiple hard disks are used and therefore there is an increase in performance, however there is no redundancy. We will look at a number of different RAID levels and this is the only one that we will look at that does not have redundancy. To remember which one does not have redundancy, I like to remember that RAID 0 has zero redundancy. If I remember this saying, it reminds me of that fact.
Let’s look at an example to understand how RAID 0 works.
Let’s consider that we have four hard disks in the one RAID 0 array. To understand how it works, consider that we have two files that we are going to write to the array. The first file is in green and the second in blue. Both files have been broken down into blocks.
Let’s consider that the green file is being copied to the array. Notice that when it is copied over, each block will be copied to a different hard disk in order. Also notice that multiple writes can occur at the same time. You can see that the green file is spread out evenly over the four hard disks and no space is being used for redundancy. Thus, RAID 0 has the advantage that you don’t lose any capacity. You essentially get to use all the capacity that you purchased.
Now let’s consider that the blue file is copied over. You will notice that the next two hard disks are used to store the blue file.
Now let’s look at what has occurred. Both files have been split up and stored on multiple hard disks. Let’s consider you want to read the green file. In order to do this, all the hard disks need to be accessed. Since the hard disks are independent, all hard disks can read at the same time. After this has completed, the first two hard disks can read again at the same time. If this data was on the one hard disk, six hard disk reads would need to be completed in sequential order. In this case, we have read in parallel which has been done in the equivalent time of two sequential reads.
Now let’s consider the blue file. In order to read this, the last two hard disks can be accessed at the same time. If this file was on a single hard disk, two reads would have to be performed on the same hard disk.
In this example, all the hard disks are identical. That is, the same capacity and same performance. If the storage devices have different capacities, the array will be built based on the smallest storage device in the array. Thus, if you have a storage device with more storage than the smallest capacity storage device, this extra storage will not be accessible to the array. The same applies if one storage device is slower than the others. If this occurs, the whole array will slow down, so it is best to use identical storage devices whenever possible.
You can see in this example that reading and writing can be sped up significantly, because multiple hard disks can work independently of each other. You can see the performance improvements that RAID 0 can give; however, there is one big limitation with it, that is that if one drive is lost, all data in the array is lost. Consider that in this example there are four hard disks. Consider what is the chance of one hard disk failing. Since there are four, it is now four times more likely for this to occur. Thus, if you are going to use RAID 0 you need to consider the consequences if a hard disk fails.
Generally, RAID 0, if it is used at all, will be used for purposes where if the data is lost it is not a big concern. I would not use it for live data that you can’t afford to lose. If you do use RAID 0, it would most likely be used for temporary files or if the data is lost can be restored. Keep in mind, business downtime is often considered to be worse than spending extra money on redundancy, so if you are going to have to restore data if the array fails, will the downtime cause problems for the business.
This is the only RAID that I will look at that does not have redundancy – redundancy being, that if a storage device fails this won’t prevent the array from operating or for data to be lost. Let’s have a look at the next RAID level.
RAID 1 (Mirroring)
The next RAID level is 1 also referred to as “mirroring”. Mirroring keeps a second copy of the data and thus requires two disks to operate. Since the second copy is essentially a copy of the first, you can see where it gets the name mirroring from. It is possible to have RAID 1 use additional copies of the data, but in practice you don’t really see that occurring. As we will see later in the video, there are other solutions which offer more advantages than simply duplicating the data.
RAID 1 adds redundancy, but it does this by halving the amount of usable space. So, you can understand that it effectively doubles the cost of your data. RAID 1 has some performance improvements for reading but not for writing. I say some read performance, because essentially reading can be done from either of the storage devices, so this may improve random access but not write access. Let’s look at an example to see why.
In this example there are two storage devices which is what you would expect in a RAID 1 mirror. Now let’s consider what would happen if we copied two files to the array. To start with, I will copy the green file.
Notice that when the file is being copied to the array, the block is duplicated and both hard disks write the data at the same time. Since both hard disks are writing the same block at the same time, there is no performance improvement.
When the blue file is copied to the array, you will see the same result. Thus, no performance increase is seen as both hard disks need to be updated with the same data.
When reading, this is where it starts getting interesting. Let’s have a look what will most likely happen if we attempt to read the green file. You will notice, in this example, that only hard disk one was used. Hard disks store data sequentially and thus work best when data is read that way. When this occurs it can take advantage of speed improvements such as bursting, which is reading a lot of data very quickly. If data was attempted to be read from both hard disks, this would involve a lot of random reads which would ultimately slow things down, since the hard disk would not be able to use features like bursting.
However, sometimes you will get a performance increase when reading. To understand this, consider what happens if we attempt to read both files at the same time. You can see in this case one hard disk could be reading file 1 and the other reading file 2. This won’t affect features like bursting, and thus you will see a performance increase.
In the real world, the performance gain you get from mirroring is minor. On a production system, you probably won’t even notice it. RAID 1, when it is used, will be for redundancy and not for performance. Having two copies of the data means that if one hard disk is lost you have a second copy. It is just a matter of removing the failed hard disk and replacing it. Once the hard disk is installed, the data from the existing hard disk will need to be copied to the new hard disk so you again have redundancy.
RAID 1 is often used for the operating system drive. The operating system is generally pretty small compared with the data it is using. Thus, RAID 1 is used for the operating system drive and other RAIDs, that I will look into later, are used for the data the operating system needs to access.
Generally, when using RAID, you will use the one controller, however RAID 1 can be implemented using two controllers.
Disk Duplexing
When RAID 1 is implemented using separate RAID controllers, this is referred to as “disk duplexing”. This is in the CompTIA study guide; however, in the real world I don’t think that you will ever come across it. In a data center maybe, but nowadays even in a data center this is unlikely since there are different and better solutions available.
By adding a second RAID controller you are effectively adding redundancy for the controller. This means if one of the RAID controllers was to fail the other RAID controller would keep operating. Disk duplexing is rarely supported and it would be difficult to find a RAID controller that supports it nowadays. Data storage solutions that you would find in high-end equipment offer other solutions such as multipath which achieve redundancy for a failed controller but is not limited to disk duplexing. You can see why it is not really supported nowadays, but CompTIA talks about it, so I mention it. Now on to the next RAID level.
RAID 5 (Striped With Parity)
The next RAID is RAID 5. This RAID level requires a minimum of three storage devices. One of these storage devices is lost to parity, but this provides redundancy for the failure of one drive. Essentially this means that, if you lose one of the storage devices the RAID will keep operating. When you replace a storage device, the RAID will rebuild itself using that storage device and you are good to go.
RAID 5 used to be very popular but has become less so over the years. This is because it is vulnerable to data loss while the RAID is being rebuilt. If you have a second failure while the RAID is rebuilding, you lose all your data. In the old days this was not such a problem, but nowadays with really large storage devices rebuild can take a very long time to complete. If you have a RAID 5 array with ten hard disks in it, keep in mind your risk of failure is ten times what it would be with just one drive. If it takes hours to rebuild the array and you have a second failure, all the data on those ten drives is now gone.
RAID 5 has fast read speeds and slow write speeds. Every time it has to write data, it essentially needs to read all the other drives in order to update the parity information. This is time consuming. Reading, however, is very fast since the more drives you have the more independent reading it can do. Let’s consider an example using our two files to understand a bit better how it works.
In this example we have four hard disks. Effectively one hard disk is lost to parity, so the more hard disks you add the more space efficient it is; however, there is a higher risk of data loss if you have two failures in a short period of time.
So, let’s consider what happens when we write the green file to the array. In this case, the three blocks are written to the first three hard disks. You will notice that the fourth hard disk will contain parity information. When any blocks on any of the other hard disks are changed the parity must be updated as well. In this case we know what the data is because we are writing to all the drives; if we did not know what the data was, we would need to read the other drives first to find what the data was so we can update the parity information.
Different RAID arrays have different ways of calculating parity. Regardless of the method, it basically uses a mathematical formula. When you lose a hard disk, to get the data back you are losing some of the information but can get it back using other information. Essentially, this is doing the same as you would in math, solving for X in a formula.
Although you lose one hard disk to parity, most RAID solutions will distribute the parity information across all the hard disks in the array. Since the parity information will need to be updated when other data is changed, it makes sense to have it scattered across all the drives, as in that way the writes are spread out over the drives.
I will next write the remaining parts of the green file to the array. In this case, since I am writing a lot of data at once, the array is performing quite well. However, in order to get this performance, you would need to be updating all the hard disks in the array at once. This gets harder when there are more hard disks involved. Let’s have a look what happens when you have a smaller file.
In the case of the blue file, this file only takes up two blocks. It will get copied over like the green file did. We are not able to calculate the parity because we don’t have the data for all the drives. In order to get this information, we need to read the fourth hard disk. The fourth hard disk does not have any data on it yet, but we still need to read it to confirm that is the case. Once we have this information, we can write the parity data to the drive.
You can see that when you are writing a lot of data at once you may get good performance, but keep in mind that RAIDs generally use very large sector sizes, so you are going to have to be writing a lot of data at once to get this performance benefit. In most cases you won’t be doing this, so write performance won’t be good. If, for example, you want to write to one block, you would need to read the other blocks and then update the parity information. You can now see why RAID-5 is generally not good for writing.
Reading on the other hand is a different story. If we want to read the blue file, both hard disks could respond at the same time. If I was reading the green file, you would have all the hard disks doing at least one read. Thus, you can see that RAID-5 can be quite good for reading but not so good for writing.
The major disadvantage with RAID 5 is, if you have a second failure before the array has had time to rebuild itself using a replacement drive, you lose all the data on the array. If you are using a large array with a lot of hard disks, that is a lot of data you are risking. Given that hard disks are getting larger in size, the rebuild time is getting longer and longer. Let’s have a look at how this issue can be addressed.
RAID 6
One way is by using RAID 6. RAID 6 is essentially the same as RAID 5 but it has two parity drives. As it is very similar, I won’t spend too much time on it since how it works is so similar to RAID 5. With two parity drives, the array can sustain two device failures. Since there are two parity drives, this means that both need to be updated when writes are performed. This means write speeds are slower than with RAID 5.
RAID 6 addressed some of the problems with RAID 5 but did not really take off. Risk of loss of data, rebuild time and performance were still all factors. For large data storage needs, a different method was created to provide increased redundancy and performance.
RAID 1+0 (10)
One of the more popular RAID implementations is RAID 1 + 0 otherwise known as RAID 10. Technically it is not its own RAID level but a hybrid RAID, as it combines RAID 1 and RAID 0 together. Essentially it is a “stripe of mirrors”. Let’s have a look.
Firstly, let’s do some revision of RAID 0. Let’s consider our two files. With RAID 0, the data is striped across the array. So, I will copy the green file to the array. You will notice that all three storage devices work independently of each other giving good write speed. The storage devices all work together to also provide good read speed. So far, we have good performance but we don’t have any redundancy.
To add redundancy, each storage device is mirrored. This does not affect performance because the hard disks essentially work in pairs. You will notice that when I copy the blue file to the array, all the writes are completed at once. Thus, you get excellent read and write performance. The cost is you require twice as much storage.
Given how the cost of storage has come down and also the capacity of the storage has gone up, for places like data centers, this is affordable to get redundancy while still getting good performance.
In a system like this, if one hard disk was to fail, this would not affect the operation of the RAID. In fact, the RAID can have more failures. In this case, half the hard disks in the RAID have failed. The RAID will still keep operating because there is still at least one copy of the data available.
If all the hard disks are replaced and the RAID has time to rebuild, it will be essentially like the failure never happened. However, if you have two failures in the same set of data, the whole RAID will be lost. When you have a large RAID with ten or twenty hard disks in them, the chance of having two hard disks fail in the same mirror are very low. You can now see why this is a good tradeoff between performance and redundancy.
I will next have a look at a variation of this RAID.
RAID 0+1
RAID 0+1 is much the same as the previous RAID, but is implemented differently. As before, it combines RAID 0 and RAID 1. But rather than being a stripe of mirrors it is a “mirror of stripes”. So, essentially the opposite of what we just looked at. Again, it provides performance and redundancy but does this at the cost of storage, that is, doubling the price.
In this example, there are four hard disks working in RAID 0. I will use my two files to illustrate how it works. So, let’s consider what occurs when I copy the green file over. You will notice that the four hard disks work independently of each other to write the first file to the disks. Thus, the write performance is very good. Read performance will also be really good because all the hard disks work independently of each other.
RAID 0 does not offer any redundancy and thus, to get redundancy, this is where we add a mirror. So, you can see we are doubling the amount of storage required. This does give us redundancy, but let’s consider what happens to performance.
You will notice that when I write the blue file, the hard disks still work independently of each other. The mirror drives operate at the same time, so you are not losing any time writing. You are, however, still getting the performance increase of having the data spread over multiple hard disks. So, you can see for the cost of doubling your storage, you can get a performance increase as well.
If you have a failure of one of the hard disks, the array will still operate. The array can still have failures as long as the corresponding mirrored hard disk does not fail. So, for example, you could have in this case up to four hard disks fail as long as the mirrored hard disk, or the one opposite, does not fail.
Once a hard disk has failed, it is just a matter of replacing it and the data will be copied from the other hard disk. If, however, the second failure is the second copy, you will lose the whole array. There is still a risk, however the risk is very low.
These are the common RAID solutions available. There are others, particularly if you start working with massive amounts of storage. However, if you understand the common RAID types you will be able to pick up the others.
In the case of RAID, it works best with storage devices of the same type and size. If you used storage devices of different speeds the slower devices will slow down the whole RAID. If your storage devices are of different sizes, the RAID will be built based on the smallest storage device. There however is a none-RAID solution you can use to combine storage devices of different types.
JBOD (Spanning)
The most common solution you will find to combine multiple storage devices together in one is called Just a Bunch of Disks or JBOD. In hardware you will generally see it referred to as JBOD, in software it may be referred to as spanning. JBOD combines multiple storage devices together to form one storage unit. Unlike RAID, it does not matter if there are different types of drives or if they are of different capacities.
The downside of JBOD is, there is no redundancy and since it is made up of different storage types, performance is variable. To understand how it works, let’s consider that you have two hard disks and one Solid-State Drive. The hard disks are of different types and capacities. The storage devices themselves are not suitable for RAID as they are different types and capacities. You will generally find, over time, you will get a collection of unused storage devices of different sizes and types that you don’t know what to do with; JBOD is a possible use for these devices. Keep in mind, since it has no redundancy, you should not be putting data on it that you can’t afford to lose.
JBOD essentially combines all the storage devices together into one, so the operating system only sees one storage device.
It does this by simply combining the space together in linear order. It does not use striping as RAID does to spread the data out over the drives, the storage is simply presented in the same order as the storage devices. You can see why performance is variable. If you were accessing a large file and it was stored on the slow hard disk, accessing the file would be slow. If the same file happened to be stored on the Solid-State Drive access would be fast. If you are accessing a lot of small files and they were stored on all the different devices, you would get some good performance from JBOD. Other than this rare case, I would expect variable performance from JBOD ranging from the slowest performance device to the highest performing device. It all depends on where the data the operating system is trying to access is stored.
Summary
There has been a lot covered in this video, so I will do a quick summary of the major points. RAID 0, otherwise known as striping scatters the blocks of data out sequentially on the available storage devices. It requires a minimum of two disks in order to operate. Reading performance is excellent and so is writing performance. There is no redundancy, so if one of your storage devices fails you lose all the data in the RAID. To help me remember this RAID level, I like to remember that RAID 0 has zero redundancy.
The next level is RAID 1, also called mirroring. This RAID level requires two storage devices. Depending on what you are using, it is possible to increase the number of storage devices above two. Since the data is effectively duplicated, reading and writing performance is essentially the same as one storage device. Although it is possible to read data from both storage devices at the same time, don’t expect too much of a performance increase. This level of RAID will still operate even after one storage device fails.
The next RAID level is RAID 5, otherwise known as striping with parity. This RAID level spreads the data out over all the storage devices as RAID 0 does; however, one drive is lost to storing parity information. For this reason, a minimum of three disks is required. Since the data is stored on separate disks, the read performance is excellent, however, write performance is poor because whenever writes occur, the parity needs to be updated. In order to update the parity, the RAID needs to know what the data is on the other storage devices which often means reading the other storage devices. This slows everything down. RAID 5 will still operate with the loss of one storage device, but when a storage device fails this leaves the whole RAID vulnerable to data loss if another storage device were to fail. Given the long time to rebuild RAIDs with the large capacity hard disks now on the market, RAID 5 is not as popular as it once was.
The next RAID level is six. RAID 6 is the same as RAID 5 except that another storage device is required to store parity. Thus, the minimum number of storage devices required is four. Since the data is striped over multiple storage devices, read performance is excellent. However, write performance is poor. Write performance is poor because the parity must be updated. This may involve reading the other hard disks to determine what the other data is, so the parity can be updated.
The next RAID is 1+0 otherwise known as RAID 10. I have also combined this with 0+1, although the implementation is different, the result they achieve is the same and the requirements are the same. In order to use this RAID, you require a minimum of four storage devices. Since the storage devices are mirrored, the number of storage devices that you use needs to be an even number. Since data is striped and there is no parity information stored on the storage devices, read and write performance are both excellent. The RAID can withstand a minimum of one failure. However, up to half the storage devices can fail as long as there is always at least one copy of the data available.
The last configuration that I looked at was not a RAID solution but is designed to be able to combine multiple drives together and is called JBOD; this stands for Just a Bunch of Disks, otherwise known as spanning. This is the only solution I have looked at that allows you to combine storage devices of different types and sizes. If you are using any of the other RAID solutions, it is recommended that you use storge devices of the same type and capacity. To use JBOD, you require a minimum of two disks. As the data is not being striped, your read and write performance will depend on which storage device is been accessed, and thus your performance varies. Since there is no redundancy, if a storage device fails you risk losing all the data.
End Screen
That concludes this video from ITFreeTraining on RAID. I hope you have found it useful, and I look forward to seeing you in future videos from us where we look at how to set up and use RAID. Until those videos, I would like to thank you for watching.
References
“The Official CompTIA A+ Core Study Guide (Exam 220-1001)” Chapter 6 Paragraph 266 – 276
“CompTIA A+ Certification exam guide. Tenth edition” Pages 303 – 308
“RAID” https://en.wikipedia.org/wiki/RAID
“Picture: Windows of building” https://unsplash.com/photos/s-MjjcDpr-k
“Picture: Track and field” https://unsplash.com/photos/5GcXfGEXBgI
“Picture: Kittens” https://unsplash.com/photos/vmFEBIEz0hQ
“Picture: Ice Cream” https://unsplash.com/photos/uMYxldWYSZk
“Picture: Coconut” https://www.pexels.com/photo/close-up-photo-of-a-coconut-with-white-flesh-4294736/
“Picture: Karate kick” https://www.pexels.com/photo/silhouette-of-man-doing-kick-jump-during-sunset-1086113/
“Picture: Boot” https://unsplash.com/photos/6QLRxAfLkv0
“Picture: Running person” https://pixabay.com/vectors/hurry-up-sport-speed-running-2785528/
“Picture: Sale bag” https://pixabay.com/illustrations/sale-bargain-shopping-bag-4576536/
“Picture: Money” https://pixabay.com/vectors/money-coin-cash-finance-currency-1673582/
“Picture: Under construction” https://www.pexels.com/photo/under-construction-signage-on-laptop-keyboard-211122/
“Picture: Fail” https://pixabay.com/illustrations/fail-lose-failing-failure-business-1714367/
“Picture: Fire” https://unsplash.com/photos/BdTtvBRhOng
Credits
Trainer: Austin Mason http://ITFreeTraining.com
Voice Talent: HP Lewis http://hplewis.com
Quality Assurance: Brett Batson http://www.pbb-proofreading.uk