Understanding RAID
RAID — which stands for Redundant Arrays of Inexpensive Disks (as named by the inventor) or Redundant Arrays of Independent Disks (a name which later developed within the computing industry) — is a technology that employs the simultaneous use of two or more hard disk drives to achieve greater levels of performance, reliability, and/or larger data volume sizes.
RAID is a way of combining multiple disk drives into a single entity to improve performance and/or reliability. There are a variety of different types and implementations of RAID, each with its own advantages and disadvantages. For example, by putting a copy of the same data on two disks (called disk mirroring , or RAID level 1), read performance can be improved by reading alternately from each disk in the mirror. On average, each disk is less busy, as it is handling only 1/2 the reads (for two disks), or 1/3 (for three disks), etc. In addition, a mirror can improve reliability: if one disk fails, the other disk(s) have a copy of the data. Different ways of combining the disks into one, referred to as RAID levels , can provide greater storage efficiency than simple mirroring, or can alter latency (access-time) performance, or throughput (transfer rate) performance, for reading or writing, while still retaining redundancy that is useful for guarding against failures.
IMPORTANT NOTE: Although RAID can protect against disk failure, it does not protect against operator and administrator (human) error, or against loss due to programming bugs (possibly due to bugs in the RAID software itself). The net abounds with tragic tales of system administrators who have bungled a RAID installation, and have lost all of their data. RAID is not a substitute for frequent, regularly scheduled backup.
Important RAID Levels:
JBOD - "Just a Bunch Of Disks"
JBOD isn't really a RAID level at all, but is included here as many External RAID systems offer JBOD functionality as well as standard RAID levels. JBOD can be thought of as the opposite of partitioning: while partitioning chops single drives up into smaller logical volumes, JBOD combines drives into larger logical volumes. It provides no fault tolerance, nor does it provide any improvements in performance compared to the independent use of its constituent drives.
Sometimes also called Concatenation or Spanning, JBOD is a popular method for combining multiple hard disk drives into a single virtual disk.
RAID 0 - Data Striping
RAID 0 (RAID Zero) is simply data striped over several disks. This gives a performance advantage, as it is possible to read parts of a file in parallel. However not only is there no data protection, it is actually less reliable than a single disk, as all the data is lost if a single disk in the array stripe fails.

RAID 1 - Data Mirroring
RAID 1 is also referred to as "mirroring". Two (or more) partitions, all of the same size, each store an exact copy of all data, disk-block by disk-block. This is useful when read performance or reliability are more important than data storage capacity. Such an array can only be as big as the smallest disk in the RAID 1 array. A typical RAID 1 mirrored pair contains two disks (see diagram), which increases reliability proportionally over a single disk. Since each member contains a complete copy of the data, and can be addressed independently, ordinary wear-and-tear reliability is raised by the power of the number of self-contained copies.
Mirroring gives strong protection against disk failure: if one disk fails, there is another with the an exact copy of the same data. Mirroring can also help improve performance in I/O-laden systems, as read requests can be divided up between several disks. Unfortunately, mirroring is also the least efficient in terms of storage: two mirrored partitions can store no more data than a single partition.

RAID 5 - Striped Set with Distributed Parity
RAID 5 uses block-level striping with parity data distributed across all member disks. Distributed parity requires all drives but one to be present to operate; drive failure requires replacement, but the array is not destroyed by a single drive failure. Upon drive failure, any subsequent reads can be calculated from the distributed parity such that the drive failure is masked from the end user. The array will have data loss in the event of a second drive failure and is vulnerable until the data that was on the failed drive is rebuilt onto a replacement drive.
However, write performance is still not as good as for mirroring, as the parity stripe must still be read and XOR'ed before it is written. Read performance is also not as good as it is for mirroring, as, after all, there is only one copy of the data, not two or more. RAID-5's principle advantage over mirroring is that it offers redundancy and protection against single-drive failure, while offering far more storage capacity when used with three or more drives.

Other RAID Levels:
RAID 2 is a theoretical entity. It stripes data at bit level across an array of disks, then writes check bytes to other disks in the array. The check bytes are calculated using a Hamming code. Theoretical performance is very high, but it would be so expensive to implement that no-one uses it.
RAID 3 A block of data is striped over an array of disks, then parity data is written to a dedicated parity disk. Successful implementations usually require that all the disks have synchronised rotation. RAID3 is very effective for large sequential data, such as satellite imagery and video. The single parity disk is a bottle-neck for writing since every write requires updating the parity data.
RAID 4 data is written in blocks onto the data disks (i.e. not striped), then parity is generated and written to a dedicated parity disk. Identical to RAID 3 but does block-level striping instead of byte-level striping.
RAID 6 is growing in popularity as it is seen as the best way to guarantee data integrity as it uses double parity. It was originally used in SUN V2X devices, where there are a lot of disks in a RAID array, and so a higher chance of multiple failures. RAID6 as implemented by SUN does not have a write overhead, as the data is always written out to a different block. Most importantly, RAID 6 provides fault tolerance from two drive failures; array continues to operate with up to two failed drives.
This makes larger RAID groups more practical, especially for high availability systems. This becomes increasingly important because large-capacity drives lengthen the time needed to recover from the failure of a single drive. Single parity RAID levels are vulnerable to data loss until the failed drive is rebuilt: the larger the drive, the longer the rebuild will take. Dual parity gives time to rebuild the array without the data being at risk if one drive, but no more, fails before the rebuild is complete.
RAID 1+0 (Often called RAID 10) is a combination of RAID 1 mirroring and data striping. This means it has very good performance, and high reliability, so its ideal for mission critical database applications. All that redundancy means that it is expensive.
RAID 50 is implemented as a RAID 5 array that is then striped in RAID 0 fashion for fast access.
RAID Z is part of the SUN ZFS file system. It is a software based variant of RAID5 which does not used a fixed size RAID stripe but writes out the current block of data as a varying size RAID stripe. With standard RAID, data is written and read in blocks and several blocks are usually combined together to make up a RAID stripe. If you need to update one data block, you have to read back all the other data blocks in that stripe to calculate the new RAID parity. RAIDZ eliminates the RAID 5 write penalty as any read and write of existing data will just include the current block. In a failure, data is re-created by reading checksum bytes from the file system itself, not the hardware, so recovery is independent of hardware failures. The problem, of course is that RAIDZ closely couples the operating system and the hardware. In other words, you have to buy them both from SUN.
Hardware RAID vs Software RAID
There are two possible RAID approaches: Hardware RAID and Software RAID. Most RAID arrays use what is termed a Hardware RAID. This means using dedicated hardware to control the array, as opposed to doing array control processing via software. Good hardware controllers are in many ways like miniature computers, incorporating dedicated processors.
Hardware RAID
There are two main types of hardware RAID, differing primarily in how they interface the array to the system:
Bus-Based or Controller Card Hardware RAID: A specialised RAID controller is installed into the Mac, and the array drives are connected to it.
External RAID Controller: In this higher-end design, the RAID controller is removed completely from the system and the RAID Controlling is performed inside the Hard Drive enclosure via what is often called an Onboard RAID Controller. Within the enclosure, the RAID controller manages the drives in the array. The enclosure is then connected to the computer via USB, Firewire or fast eSATA, and is visible to the host computer as a single hard disk.
Software RAID:
Software RAID has the same result as a Hardware RAID, except that it uses software instead of hardware (Amazing!). Instead of using a dedicated hardware controller to perform the various functions required to implement a RAID array, these functions are performed by the operating system using dedicated software coding.
There are a few advantages of using software RAID over hardware RAID, but more disadvantages.
Advantages:
1 - Cost: If you are already running an operating system that supports software RAID, you have no additional costs for controller hardware; you may need to add more system memory to the system.
2 - Simplicity: You don't have to install, configure or manage a hardware RAID controller.
Disadvantages:
1 - Performance: The best-known drawback of software RAID is that it provides lower overall system performance than hardware RAID. The effect is more substantial for RAID 5 configurations.
2 - Boot Volume Limitations: Since the operating system has to be running to enable the array, this means the operating system cannot boot from the RAID array! This requires a separate, non-RAID partition to be created for the operating system, segmenting capacity, lowering performance f urther and slowing boot time.
3 - Level Support: Software RAID is usually limited to RAID levels 0, 1 and 5.
4 - Advanced Feature Support: Software RAID normally doesn't include support for advanced features like Hot Spares and Drive Swapping, which improve availability.
5 - Operating System Compatibility Issues: If you set up RAID using a particular operating system, only that operating system can generally access that array. If you use another operating system it will not be able to use the array.
6 - Software Compatibility Issues: Some software utilities may have conflicts with software RAID arrays; for example, some partitioning and formatting utilities. Again, hardware RAID is more "transparent" and may avoid these problems.
7 - Reliability Concerns: Some RAID users avoid software RAID over concern with potential bugs that might compromise the integrity and reliability of the array. While hardware RAID controllers can certainly also have bugs, I think it's reasonable to believe that some operating systems are more likely to have these sorts of problems than a good-quality hardware RAID controller would.
Useful Link: Software RAID - How To Create a RAID Set in Mac OS X Disk Utility
Hot spares
Both hardware and software RAID arrays with redundancy may support the use of hot spare drives, a drive physically installed in the array which is inactive until an active drive fails, when the system automatically replaces the failed drive with the spare, rebuilding the array with the spare drive included. This reduces the mean time to repair (MTTR), though it doesn't eliminate it completely. A second drive failure in the same RAID redundancy group before the array is fully rebuilt will result in loss of the data; rebuilding can take several hours, especially on busy systems.
Rapid replacement of failed drives is important as the drives of an array will all have had the same amount of use, and may tend to fail at about the same time rather than randomly. RAID 6 without a spare uses the same number of drives as RAID 5 with a hot spare and protects data against simultaneous failure of up to two drives, but requires a more advanced RAID controller.


