RAID Technology

Reference and Sources:

  • The most part of text in this guide has been taken from copyrighted document of Adaptec, Inc. on site (
  • Perceptive Solutions, Inc.

RAID stands for Redundant Array of Inexpensive (or sometimes "Independent") Disks.
RAID is a method of combining several hard disk drives into one logical unit (two or more disks grouped together to appear as a single device to the host system). RAID technology was developed to address the fault-tolerance and performance limitations of conventional disk storage. It can offer fault tolerance and higher throughput levels than a single hard drive or group of independent hard drives. While arrays were once considered complex and relatively specialized storage solutions, today they are easy to use and essential for a broad spectrum of client/server applications.

Redundant Arrays of Inexpensive Disks (RAID)

"KILLS - BUGS - DEAD!"
-- TV commercial for RAID bug spray

There are many applications, particularly in a business environment, where there are needs beyond what can be fulfilled by a single hard disk, regardless of its size, performance or quality level. Many businesses can't afford to have their systems go down for even an hour in the event of a disk failure; they need large storage subsystems with capacities in the terabytes; and they want to be able to insulate themselves from hardware failures to any extent possible. Some people working with multimedia files need fast data transfer exceeding what current drives can deliver, without spending a fortune on specialty drives. These situations require that the traditional "one hard disk per system" model be set aside and a new system employed. This technique is calledRedundant Arrays of Inexpensive DisksorRAID. ("Inexpensive" is sometimes replaced with "Independent", but the former term is the one that was used when the term "RAID" was first coined by the researchers at the University of California at Berkeley, who first investigated the use of multiple-drive arrays in 1987.)

The fundamental principle behind RAID is the use of multiple hard disk drives in an array that behaves in most respects like a single large, fast one. There are a number of ways that this can be done, depending on the needs of the application, but in every case the use of multiple drives allows the resulting storage subsystem to exceed the capacity, data security, and performance of the drives that make up the system, to one extent or another. The tradeoffs--remember, there's no free lunch--are usually in cost and complexity.

Originally, RAID was almost exclusively the province of high-end business applications, due to the high cost of the hardware required. This has changed in recent years, and as "power users" of all sorts clamor for improved performance and better up-time, RAID is making its way from the "upper echelons" down to the mainstream. The recent proliferation of inexpensive RAID controllers that work with consumer-grade IDE/ATA drives--as opposed to expensive SCSI units--has increased interest in RAID dramatically. This trend will probably continue. I predict that more and more motherboard manufacturers will begin offering support for the feature on their boards, and within a couple of years PC builders will start to offer systems with inexpensive RAID setups as standard configurations. This interest, combined with my long-time interest in this technology, is the reason for my recent expansion of the RAID coverage on this site from one page to 80. :^)

Unfortunately, RAID in the computer context doesn't really kill bugs dead. It can, if properly implemented, "kill down-time dead", which is still pretty good. :^)

History

RAID technology was first defined by a group of computer scientists at the University of California at Berkeley in 1987. The scientists studied the possibility of using two or more disks to appear as a single device to the host system.
Although the array's performance was better than that of large, single-disk storage systems, reliability was unacceptably low. To address this, the scientists proposed redundant architectures to provide ways of achieving storage fault tolerance. In addition to defining RAID levels 1 through 5, the scientists also studied data striping -- a non-redundant array configuration that distributes files across multiple disks in an array. Often known as RAID 0, this configuration actually provides no data protection. However, it does offer maximum throughput for some data-intensive applications such as desktop digital video production.

The driving factors behind RAID

A number of factors are responsible for the growing adoption of arrays for critical network storage.
More and more organizations have created enterprise-wide networks to improve productivity and streamline information flow. While the distributed data stored on network servers provides substantial cost benefits, these savings can be quickly offset if information is frequently lost or becomes inaccessible. As today's applications create larger files, network storage needs have increased proportionately. In addition, accelerating CPU speeds have outstripped data transfer rates to storage media, creating bottlenecks in today's systems.
RAID storage solutions overcome these challenges by providing a combination of outstanding data availability, extraordinary and highly scalable performance, high capacity, and recovery with no loss of data or interruption of user access.
By integrating multiple drives into a single array -- which is viewed by the network operating system as a single disk drive -- organizations can create cost-effective, minicomputersized solutions of up to a terabyte or more of storage.

Principles

RAID combines two or more physical hard disks into a single logical unit using special hardware or software. Hardware solutions are often designed to present themselves to the attached system as a single hard drive, so that the operating system would be unaware of the technical workings. For example, if one were to configure a hardware-based RAID-5 volume using three 250GB hard drives (two drives for data, and one for parity), the operating system would be presented with a single 500GB volume. Software solutions are typically implemented in the operating system and would present the RAID volume as a single drive to applications running within the operating system.

There are three key concepts in RAID: mirroring, the writing of identical data to more than one disk; striping, the splitting of data across more than one disk; and error correction, where redundant ("parity") data is stored to allow problems to be detected and possibly fixed (known as fault tolerance). Different RAID schemes use one or more of these techniques, depending on the system requirements. The purpose of using RAID is to improve reliability and availability of data, ensuring that important data is not harmed in case of hardware failure, and/or to increase the speed of file input/output.

Mirroring

Mirroringis one of the two data redundancy techniques used in RAID (the other beingparity). In a RAID system using mirroring, all data in the system is written simultaneously totwohard disks instead of one; thus the "mirror" concept. The principle behind mirroring is that this 100% data redundancy provides full protection against the failure of either of the disks containing the duplicated data. Mirroring setups always require an even number of drives for obvious reasons.

The chief advantage of mirroring is that it provides not only complete redundancy of data, but also reasonably fast recovery from a disk failure. Since all the data is on the second drive, it is ready to use if the first one fails. Mirroring also improves some forms of readperformance(though it actually hurts write performance.) The chief disadvantage of RAID 1 is expense: that data duplication means half the space in the RAID is "wasted" so you must buy twice the capacity that you want to end up with in the array. Performance is also not as good as some RAID levels.

Block diagram of a RAID mirroring configuration. The RAID controller
duplicates the same information onto each of two hard disks. Note that
the RAID controller is represented as a "logical black box" since its functions
can be implemented insoftware, or severaldifferent types of hardware
(integrated controller, bus-based add-in card, stand-alone RAID hardware.)

Mirroring is used inRAID 1, as well as multiple-level RAID involving RAID 1 (RAID 01 or RAID 10). It is related in concept toduplexing. Very high-end mirroring solutions even include such fancy technologies asremote mirroring, where data is configured in a RAID 1 array with the pairs split between physical locations to protect against physical disaster! You won't typically find support for anything that fancy in a PC RAID card. :^)

Duplexing

Duplexingis an extension ofmirroringthat is based on the same principle as that technique. Like in mirroring, all data is duplicated onto two distinct physical hard drives. Duplexing goes one step beyond mirroring, however, in that it also duplicates the hardware that controls the two hard drives (or sets of hard drives). So if you were doing mirroring on two hard disks, they would both be connected to a singlehost adapterorRAID controller. If you were doing duplexing, one of the drives would be connected to one adapter and the other to a second adapter.

Block diagram of a RAID duplexing configuration. Two controllers are used
to send the same information to two different hard disks. The controllers are
often regular host adapters or disk controllers with the mirroring done by the
system. Contrast this diagram with the one for straight mirroring.

Duplexing is superior to mirroring in terms of availability because it provides the same protection against drive failure that mirroring does, but also protects against the failure of either of the controllers. It also costs more than mirroring because you are duplicating more hardware. Duplexing is one option when implementing RAID 1 (though most people think of RAID 1 as only being mirroring, and certainly, mirroring is much more commonly implemented than duplexing.)

Since hardware RAID is typically set up under the assumption that the RAID controller will handle all the drives in the array, duplexing is not supported as an option in most PC hardware RAID solutions--even fairly high-end ones. Duplexing is more often found in software RAID solutions managed by the operating system, where the operating system is running the RAID implementation at a high level and can easily split the data between the host adapters. (There are hardware RAID duplexing solutions but usually only on very expensive external RAID boxes.)

Striping

The main performance-limiting issues with disk storage relate to the slow mechanical components that are used forpositioning and transferring data. Since a RAID array has many drives in it, an opportunity presents itself to improve performance by using the hardware in all these drivesin parallel. For example, if we need to read a large file, instead of pulling it all from a single hard disk, it is much faster to chop it up into pieces, store some of the pieces on each of the drives in an array, and then useallthe disks to read back the file when needed. This technique is calledstriping, after the pattern that might be visible if you could see these "chopped up pieces" on the various drives with a different color used for each file. It is similar in concept to the memory performance-enhancing technique calledinterleaving.

Striping can be done at the byte level, or in blocks. Byte-level striping means that the file is broken into "byte-sized pieces" (heehee, sorry about that, I just couldn't resist. ;^) ) The first byte of the file is sent to the first drive, then the second to the second drive, and so on. (Seethe discussion of RAID level 3for more on byte-level striping.) Sometimes byte-level striping is done as a sector of 512 bytes. Block-level striping means that each file is split into blocks of a certain size and those are distributed to the various drives. The size of the blocks used is also called thestripe size(orblock size, or several other names), and can be selected from a variety of choices when the array is set up;see here for more details.

Block diagram of a RAID striping configuration. One controller (which again
can be hardware or software) splits files into blocks or bytes and distributes
them across several hard disks. The block size determines how many "pieces" files
will be split into. In this example, the first block of file 1 is sent to disk #1, then the
second block to disk #2, etc. When all four disks have one block of file 1, the
fifth block goes back to disk #1, and this continues until the file is completed. Note
that file 3 is only on one disk; this means it was smaller than the block size in this case.

Striping is used in the implementation of most of the basic,single RAID levels(and by extension, anymultiple RAID levelsthat use those single RAID levels). However, the actual way striping is set up, and how it is used, varies greatly from level to level. RAID 0 uses block-level striping without parity; RAID 3 and RAID 7 use byte-level striping with parity; and RAID 4, RAID 5 and RAID 6 use block-level striping with parity. Note the distinction between striping with and without parity: striping by itself involves no redundancy, and therefore,provides no data protection. Also see the discussion ofRAID 2for a look at the oddball bit-level striping with ECC defined by that RAID type.

Some companies use the term "spanning" when they really mean striping. Spanning really normally refers toJBOD.

Parity

Mirroringis a data redundancy technique used by some RAID levels, in particularRAID level 1, to provide data protection on a RAID array. While mirroring has some advantages and is well-suited for certain RAID implementations, it also has some limitations. It has a high overhead cost, because fully 50% of the drives in the array are reserved for duplicate data; and it doesn't improve performance as much as data striping does for manyapplications. For this reason, a different way of protecting data is provided as an alternate to mirroring. It involves the use ofparity information, which is redundancy information calculated from the actual data values.

You may have heard the term "parity" before, used in the context ofsystem memory error detection; in fact, the parity used in RAID is very similar in concept to parity RAM. The principle behind parity is simple: take "N" pieces of data, and from them, compute an extra piece of data. Take the "N+1" pieces of data and store them on "N+1"drives. If you lose anyoneof the "N+1" pieces of data, you can recreate it from the "N" that remain, regardless of which piece is lost. Parity protection is used withstriping, and the "N" pieces of data are typically the blocks or bytes distributed across the drives in the array. The parity information can either be stored on a separate, dedicated drive, or be mixed with the data across all the drives in the array.

The parity calculation is typically performed using a logicaloperationcalled "exclusive OR" or "XOR". As you may know, the "OR" logical operator is "true" (1) if either of its operands is true, and false (0) if neither is true. The exclusive OR operator is "true" ifand only ifone of its operands is true; it differs from "OR" in that if both operands are true, "XOR" is false. This truth table for the two operators will illustrate:

Input / Output
#1 / #2 / "OR" / "XOR"
0 / 0 / 0 / 0
0 / 1 / 1 / 1
1 / 0 / 1 / 1
1 / 1 / 1 / 0

Uh huh. So what, right? Well, the interesting thing about "XOR" is that it is a logical operation that if performed twice in a row, "undoes itself". If you calculate "A XOR B" and then take that result and do another "XOR B" on it, you get back A, the value you started with. That is to say, "A XOR B XOR B = A". This property is exploited for parity calculation under RAID. If we have four data elements, D1, D2, D3 and D4, we can calculate the parity data, "DP" as "D1 XOR D2 XOR D3 XOR D4". Then, if we know any four of D1, D2, D3, D4 and DP, we can XOR those four together and it will yield the missing element.

Let's take an example to show how this works; you can do this yourself easily on a sheet of paper. Suppose we have the following four bytes of data: D1=10100101, D2=11110000, D3=00111100, and D4=10111001. We can "XOR" them together as follows, one step at a time:

D1 XOR D2 XOR D3 XOR D4
= ( (D1 XOR D2) XOR D3) XOR D4
= ( (10100101 XOR 11110000) XOR 00111100) XOR 10111001
= (01010101.XOR 00111100) XOR 10111001
= 01101001 XOR 10111001
= 11010000

So "11010000" becomes the parity byte, DP. Now let's say we store these five values on five hard disks, and hard disk #3, containing value "00111100", goes el-muncho. We can retrieve the missing byte simply by XOR'ing together the other three original data pieces, and the parity byte we calculated earlier, as so:

D1 XOR D2 XOR D4 XOR DP
= ( (D1 XOR D2) XOR D4) XOR DP
= ( (10100101 XOR 11110000) XOR 10111001) XOR 11010000
= (01010101 XOR 10111001) XOR 11010000
= 11101100 XOR 11010000
= 00111100