dcsimg

Introduction to RAID

RAID is one of those technologies that has really revolutionized storage. In this article, we'll review the six most common single RAID levels and describe how each works and what issues surround them.

In this layout, data is written in block stripes to the first three disks (disks 0, 1, and 2) while the third drive (disk 3) is the parity drive. The parity of the blocks across the drives is computed by the RAID controller and stored on the dedicated parity drive. In the figure The parity for A1, A2, and A3 is listed as Ap on the parity drive.

The dedicated parity drive becomes a performance bottleneck in RAID-4, particularly for write I/O. Since RAID-4 has block level striping, you can write to blocks A1 and B2 at the same time since they are on different disks. However, the parity for both blocks has to be written to the same drive which can only accommodate a single write I/O request at a time. Consequently, one of the parity writes (A1 parity or B2 parity) is blocked and the write I/O performance is reduced. For more on the performance of RAID-4, please see this link.

The capacity of RAID-4 is the following:

Capacity = min(disk sizes) * (n-1)

meaning that the capacity of RAID-4 is limited by the smallest disk (you can use different size drives in RAID-4) multiplied by the number of drives n, minus one. The “minus one” part is because of the dedicated parity drive. However, it is recommended you use drives that are the same size in RAID-4.

RAID-4 improves on the redundancy of RAID-0, which has zero data redundancy, by adding a parity disk. You can lose one drive without losing data. For example you could lose the parity disk without losing data or you could lose one of the data disks without losing data. But the introduction of the single dedicated parity drive has reduced write performance relative to RAID-0. However, if the loss of write performance of RAID-4 is acceptable it does give you more data redundancy than RAID-0.

RAID-4 was the last RAID configuration defined in the original RAID paper. In the real-world, RAID-4 is rarely used because RAID-5 (see next sub-section) has replaced it.

Table 4 below is a quick summary of RAID-4 with a few highlights.

Table 4 – RAID-4 Highlights

Raid Level Pros Cons Storage Efficiency Minimum Number of disks
RAID-4


  • Good data redundancy/availability (can tolerate the lose of 1 drive)
  • Good read performance since all of the drives are read at the same time
  • Can lose one drive without losing data


  • Single parity disk (causes bottleneck)
  • Write performance is not that good because of the bottleneck of the parity drive

(n - 1) / n where n is the number of drives 3 (have to be identical)

RAID-5
RAID-5 is similar to RAID-4 but now the parity is distributed across all of the drives instead of using a dedicated parity drive. This greatly improves write performance relative to RAID-4 since the parity is written on all of the drives in the RAID-5 array. Figure 5 below from wikipedia (image by Cburnett) illustrates how the data is written to four disks in RAID-5.

675px-RAID_5.svg.png
Figure 5: RAID-5 layout (from Cburnett at wikipedia under the GFDL license)

In this layout, the parity blocks are labeled with a subscript “p” to indicate parity. Notice how they are distributed across all four drives. The blocks that line up (one block per drive) are typically a “stripe”. In Figure 5 the blocks in a stripe are all the same color. The data stripe size is simply the following:

Data stripe size = block size * (n-1)

where n is the number of drives in the RAID-5 array. Inside a stripe there is a single parity block and all other blocks are data blocks. Anytime a block inside the stripe is changed or written to, the parity block is recomputed and rewritten (this is sometimes called the read-modify-write process). This process can add overhead reducing performance.

RAID-5 also has some write performance problems for small writes that are smaller than a single stripe since the parity needs to be computed several times which eats up computational capability of the RAID controller. As mentioned previously the read-modify-write process that must be followed happens much more often in this case.

The capacity of RAID-5 is very similar to RAID-4 and is the following:

Capacity = min(disk sizes) * (n-1)

meaning that the capacity of RAID-5 is limited by the smallest disk (you can use different size drives in RAID-5) multiplied by the number of drives n, minus one. The “minus one” part is because of the parity block per stripe.

With RAID-5 you can lose a single drive and not lose data because either the data or the parity for the missing blocks on the lost drive can be found on the remaining drives. In addition, many RAID controllers allow what is called a hot-spare drive. This drive is typically part of the RAID array but is initially not used for storing data. If the RAID group loses a drive, the hot-spare is immediately brought into the RAID group by the controller.

In the case of RAID-5, the controller immediately starts redistributing data and parity blocks to this new drive. To do this, the initial drives in the RAID-5 array have to have all blocks read and the RAID controller has to recompute parity or rebuild missing data blocks. This combination means that it can take quite a bit of time to fail-over data to the hot-spare drive. The nice thing about having a hot-spare drives is that typically the fail-over process happens automatically so there is almost no delay in incorporating the hot-spare drive.

RAID-5 has been used for a very long time and during this time the data availability and redundancy has been very good. However, there is a new phenomenon that impacts RAID-5 that has been explained in various article around the web such as this one. Basically the capacity of drives is growing quicker than the Unrecoverable Read Error (URE) rate of drives to the point where losing a drive in a RAID-5 array and recovering it to a hot-spare drive is almost guaranteed to lead to a URE which means that the RAID-5 array will be lost and the data has to be restored from a backup. However, this is the subject for another article.

There is no shortage of articles about RAID-5 on the web. You will see some strong opinions both for and against RAID-5 based on usage cases. Be sure to understand the application used when reading about both pros and cons of RAID-5. A reasonable overview of the trade-offs of RAID-5 is this article.

Table 5 below is a quick summary of RAID-5 with a few highlights.

Table 5 – RAID-5 Highlights

Raid Level Pros Cons Storage Efficiency Minimum Number of disks
RAID-5


  • Good data redundancy/availability (can tolerate the lose of 1 drive)
  • Very good read performance since all of the drives can be read at the same time
  • Write performance is adequate (better than RAID-4)
  • Can lose one drive without losing data


  • Write performance is adequate (better than RAID-4)
  • Write performance for small I/O is not good at all

(n - 1) / n where n is the number of drives 3 (have to be identical)

RAID-6
As mentioned previously, there is a potential problem with RAID-5 for larger capacity drives and a larger number of them. RAID-6 attempts to help that situation by using two parity blocks per stripe instead of RAID-5′s single parity block. This allows you to lose two drives with losing any data. Figure 6 below from wikipedia (image by Cburnett) illustrates how the data is written to four disks in RAID-6.

800px-RAID_6.svg.png
Figure 6: RAID-6 layout (from Cburnett at wikipedia under the GFDL license)

In this figure, the first parity block is noted with as subscript “p” such as Ap. The second parity block in a stripe is noted with a subscript “q” such as Aq. The use of two parity blocks reduces the useable capacity of a RAID-6 as in the following:

Capacity = min(disk sizes) * (n-2)

meaning that the capacity of RAID-6 is limited by the smallest disk (you can use different size drives in RAID-6) multiplied by the number of drives n, minus two. The “minus two” part is because of the two parity blocks per stripe.

Computing the first parity block, p, is done in the same fashion as RAID-5. However, computing the q parity block is more complicated as explained here. This means that the write performance of a RAID-6 array can be slower than a RAID-5 array for a given level of RAID controller performance. However, read performance from a RAID-6 is just as fast as a RAID-5 array since reading the parity blocks is skipped. But in exchange for worse performance, RAID-6 arrays can tolerate the lose of two drives while RAID-5 can only tolerate the lose of a single drive. Coupled with larger drives and larger drive counts, this means that larger RAID-6 arrays can be constructed realtive to RAID-5 arrays.

Table 6 below is a quick summary of RAID-6 with a few highlights.

Table 6 – RAID-6 Highlights

Raid Level Pros Cons Storage Efficiency Minimum Number of disks
RAID-6


  • Excellent data redundancy/availability (can tolerate the lose of 2 drives)
  • Very good read performance since all of the drives can be read at the same time
  • Can lose two drives without losing data


  • Write performance is not that good – worse than RAID-5
  • Write performance for small I/O is not good at all
  • more computational horsepower is required for parity computations

(n - 2) / n where n is the number of drives 4 (have to be identical)

Hybrid RAID Levels

As you can see, there are some limitations to each of the standard RAID levels (0-6). Some of the them have great performance (RAID-0) but pretty awful data availability or redundancy while others have very good data availability and redundancy (RAID-6) but the performance is not so hot. So as you can imagine, people started to wonder if they couldn’t combine RAID levels to combine features to perhaps achieve better performance while still having very good data redundancy and availability. This lead to what people called Hybrid RAID Levels or what is more commonly called Nested RAID levels.

The topic of Nested RAID levels is fairly lengthy so I will save that for another article. But the basic concept is to combine RAID levels in some fashion. For example, a common configuration is called RAID 1+0 or RAID-10. The first number (the furthest to the left) refers to the “bottom” or initial part of the RAID array. Then the second number from the left refers to the “top” level or the RAID array. The top level RAID uses the bottom level RAID configurations as building blocks.

In the case of RAID-10, the approach is to use multiple pairs of drives at the lowest level (RAID-1) and then to combine them using RIAD-0. This retains the goodness of RAID-1 for data availability and redundancy while gaining back some performance from RAID-0 striping.

Summary

This wraps our introduction to RAID. For some people it may be new and for many it will be review. Now that we’ve covered the basics, in coming articles we will be exploring Nested-RAID more in depth, including RAID-01 RAID-5, RAID-6 and RAID-10 configurations.

Have questions about RAID or topics you’d liked to see covered? Post them in the comments and we’ll try to incoorporate them as deep dive into redundant arrays.

Fatal error: Call to undefined function aa_author_bios() in /opt/apache/dms/b2b/linux-mag.com/site/www/htdocs/wp-content/themes/linuxmag/single.php on line 62