RAID 0 / 1 / 5 / 10: principles, characteristics and performance differences

1.1 RAID overview

1.1 RAID overview

RAID (redundant array of independent disks), or disk array for short.

RAID is a technique that combines multiple independent physical disks into a disk group at different RAID levels. Logically it looks like one large disk, providing greater storage capacity or higher performance than a single physical disk, while also offering different levels of data-redundancy backup.

The most direct benefits of RAID are:

  • Improved data safety
  • Improved read/write performance
  • A larger single logical-disk capacity 1.2 Implementation modes
  • Software RAID — the array operations are handled mainly by the motherboard CPU. Its downside is consuming more CPU to compute RAID; its upside is low cost.
  • Hardware RAID — a processor is built into the RAID card, so it doesn't need the server's CPU. Advantages: fastest read/write, no server resource usage, works with any OS. Disadvantage: high price. But hardware RAID is the first choice in enterprise production environments.

DELL servers support RAID 0 and 1 by default; for RAID 5 or 10 you need to buy a RAID card.

1.3 RAID vs LVM

LVM creates a logical layer on top of disk partitions to make it easier for the system to manage partitions.

Differences:

LVM: flexibly manages disk capacity, with some redundancy and performance features, but they're weak.

RAID: focuses more on performance and data safety.

1.4 Pros and cons of RAID levels

The RAID levels commonly used in production ops are RAID 0, RAID 1, RAID 5 and RAID 10.

| RAID level | Min disks | Key advantage | Key disadvantage | Real-world use | | --- | --- | --- | --- | --- | | RAID0 | 1 | Fast read/write | No redundancy at all | MySQL slave, cluster node RS | | RAID1 | 2 (only) | 100% redundancy, mirror | Average performance, high cost | Standalone, important data that can't go down: monitoring, system disk | | RAID5 | 3 | Some performance and redundancy, can lose one disk | Lower write performance | Suitable for general workloads | | RAID10 | 4 | Very fast read/write, 100% redundancy | High cost | Workloads needing both high performance and redundancy: database primary, storage master |

2.1 RAID 0

RAID 0, also called Stripe (striping), has the highest storage performance of all RAID levels (no capacity wasted, fast read/write).

RAID 0 improves performance by spreading continuous data across multiple disks. With multiple disks, a data request can be executed in parallel, each disk handling its own part of the request. This parallelism fully uses bus bandwidth and significantly improves overall disk access performance.

To build RAID 0 you need at least 1 physical disk. For example, a DELL server with a RAID card cannot use a disk without RAID unless the disk is connected directly to the motherboard, so a single disk is used as RAID 0.

raid0

2.2 RAID 0 characteristics

| Aspect | Description | | --- | --- | | Capacity | The sum of all 5 disks. Highest storage performance of all RAID levels, by spreading continuous data across multiple disks. | | Performance | In theory read/write is 5x a single disk, but due to bus bandwidth and other factors the real gain is lower than theory. Still, parallel transfer of large data clearly beats serial; the more disks, the smaller the multiple per disk. | | Redundancy | None. Lose one disk and the whole RAID is unusable. | | Use | Suitable for large-scale concurrent read/write where data safety isn't critical, e.g. MySQL slave, cluster node RS. | | Features | Fast, no redundancy, no capacity loss. |

3.1 RAID 1

RAID 1, also called Mirror/Mirroring, aims to maximize the availability and recoverability of user data. RAID 1 automatically copies 100% of the data written to disk onto another disk, storing two copies of the data.

RAID 1 supports only two disks; the whole RAID size equals the smaller of the two disks, so it's best to use disks of the same size. Data is written to both disks simultaneously for a complete backup, which lowers write performance, but reads can be concurrent — equivalent to the read efficiency of two RAID 0 disks.

| Aspect | Description | | --- | --- | | Capacity | Loses 50% of capacity; e.g. two 1T disks give 1T after RAID 1. | | Performance | Mirror doesn't improve storage performance; in theory write is about the same as a single disk. | | Redundancy | Of all RAID levels, RAID 1 offers the highest data-safety guarantee, 100% redundancy. | | Features | 100% redundancy, half the capacity lost. |

4.1 RAID 5

RAID 5 is a storage solution balancing performance, data safety and cost.

RAID 5 needs three or more physical disks. It can provide a hot spare for fault recovery and uses parity for strong reliability. Data is lost only if two disks fail at the same time; if only one disk fails, the system rebuilds the data from the stored parity to provide service temporarily. If there's a hot spare, the system also automatically rebuilds the failed disk's data onto it.

raid5

As shown, DP is the parity of D1, D2, D3, and so on. RAID 5 doesn't back up the data; it stores the data and the corresponding parity across the disks that make up the RAID, with parity and its data distributed on different disks. When one disk's data is damaged, the remaining data and parity are used to recover the damaged data.

| Aspect | Description | | --- | --- | | Performance | RAID 5 has read speed close to RAID 0, just with extra parity; write is slightly slower than a single disk. | | Capacity | Loses one disk's capacity, e.g. 10×600G -> 9×600G. | | Redundancy | Can lose one disk; data safety is lower than RAID 1 but disk utilization is higher than RAID 1. | | Use | RAID 5 can be seen as a compromise between RAID 0 and RAID 1, suitable when both performance and redundancy matter but neither needs to be extreme. Good for MySQL primary/replica and storage; ordinary servers can use RAID 5 to cut maintenance cost while keeping some redundancy and read performance. | | Features | Loses one disk of capacity, writes via parity; a compromise between RAID 1 and RAID 0. |

5.1 RAID 10

raid10

RAID 1+0, also called RAID 10, is actually the combination of RAID 1 and RAID 0. While splitting data continuously by bit or byte and reading/writing multiple disks in parallel, it mirrors each disk for redundancy. Its advantage is having both RAID 0's exceptional speed and RAID 1's high data reliability, but CPU usage is also higher and disk utilization is relatively low.

Very high read/write efficiency plus strong data protection and recovery.

Note the difference between RAID 10 and RAID 01:

RAID 01 (RAID 0+1): stripe first (RAID 0), then mirror (RAID 1).

RAID 10 (RAID 1+0): mirror first (RAID 1), then stripe (RAID 0).

| Aspect | Description | | --- | --- | | Performance | Very high read/write efficiency and strong data protection/recovery. | | Redundancy | RAID 10 provides 100% redundancy. | | Use | Suitable for database storage servers and other cases needing high performance and fault tolerance but not large capacity. | | Features | The product of combining RAID 1 and RAID 0. |