Understanding RAID

Written by Joshua Moore

June 11, 2007 | 05:25

Tags: #hard-drive #raid #redundancy

Striping

Most RAID levels employ striping, it is a term used to describe when individual files are split and written to more than one disk. Striping is the way that RAID gets around the performance limitation of mechanical storage by performing read and write operations to all disks simultaneously. In a four disk array, a quarter of each file would be on each disk. Given than each disk is only writing a quarter of the file, the operation can be done much more quickly than writing to a single disk. The same concept applies when it comes time to read the file back.

Understanding RAID RAIDTerminology

Striping can be done at byte level or block level. Byte-level striping means that each file is split up into parts one byte in size. Using the same 4 disk array as an example, the first byte would be written to the first drive, the second byte to the second drive and so on, until the fifth byte is then written to the first drive again and the whole process starts over.

In the case of block level striping, the above table can simply be repeated with the word ‘block’ substituted for ‘byte’. Each file is split into parts one block in size, which is 512 bytes by default, but can be specified otherwise. The size of this block is commonly referred to as stripe size. If a file is smaller than the stripe size, it simply gets stored on a single disk.

Striping alone does not include redundancy, and therefore includes no protection against data loss. Many RAID levels use mirroring or parity alongside striping to ensure data security and availability.

Mirroring

Mirroring is the simplest way to give redundant storage. This is a technique that can only be used on two disks unless combined with striping. When data is written to one disk, it is simultaneously written to the other disk, so in a mirrored array the two drives are always an exact copy of each other. If one of the drives fails, service can continue uninterrupted and without data loss as the other drive simply takes over. This method of redundancy doesn’t require any fancy calculations so is usually a part of onboard RAID solutions as it’s quite cheap to implement. The down side of mirroring is the inefficient use of space. In an array that uses mirroring, half of the total capacity of the disks goes to redundancy.

Parity

Parity can be used alongside striping as a way to offer redundancy without losing half of the total capacity to duplicate data. In an array using parity for redundancy, as little as one disk’s worth of space is needed to store the information needed to recover the entire array in the case of a disk failure. This parity information is derived from the data stored on the disk by using the logical ‘exclusive OR’ operation. If you haven’t had your coffee yet this morning, you may want to skip over this next bit.

Understanding RAID RAIDTerminology
The exclusive OR operation, or XOR operation, when applied to two true/false values is true if, and only if, only one of the values is true. Since we’re talking computers here, instead of true and false we’re using ones and zeroes - zero for false, one for true.

Now if you look at the table above, you’ll notice that any column in the table, if erased, can be recreated performing an XOR operation on the two remaining values. Herein lays the concept behind parity. The XOR operation can be performed on bytes of data just as it can be performed on single bits by just doing one bit at a time.

Understanding RAID RAIDTerminology
In the above table, bytes are used as opposed to single bits. Even though random values were entered into the first two columns, if one of them was erased, the information can be recreated using the XOR operation on the two remaining columns.

This method of calculating redundancy information can be used to calculate parity information in bits, bytes or blocks for any number of disks. For instance, the above example can be extended to contain an additional drive.

Understanding RAID RAIDTerminology
Notice again that if a value is erased, the values can be accurately calculated from performing the XOR operation on the remaining values in the row. What you’re looking at in the table above is essentially what a four disk RAID3 array would look like at bit level (although you’re not going to be installing many games with only 12 bytes of usable space).

The disadvantage of using parity for redundancy information is that it is computationally expensive. Go ahead and cover up one of the columns in the table above and see how long it takes you to figure out what’s there from the remaining values. Sure, computers tend to be a little quicker than mental arithmetic, but the sheer numbers of these calculations that need to be performed every second are quite staggering. If a four disk array is to sustain a 50MB/sec write speed (a relatively modest speed even by single-disk standards), the RAID controller must perform nearly 300 million XOR operations every second.

It’s far from common to see RAID configurations in the average home PC, but it isn’t especially unusual either. Let’s have a look at the RAID levels most commonly used outside server environments, how they work, and what you can expect to achieve by using them.
Discuss this in the forums
Mod of the Month May 2021 in Association with Corsair

June 18 2021 | 12:30

TOP STORIES

SUGGESTED FOR YOU