服务器RAID基本概念

Casually record some tech stuff, filtered and published here.

Basic Concepts of RAID

The full Chinese name of RAID is “独立磁盘冗余阵列” (Redundant Array of Independent Disks).

Redundant Array of Independent Disks (RAID), formerly known as Redundant Array of Inexpensive Disks, commonly referred to as a disk array. It uses virtualization storage technology to combine multiple hard drives into one or more disk array groups, aiming to improve performance, provide data redundancy, or both. During operation, depending on the RAID level, data is distributed across the drives in various patterns. RAID levels are named starting with “RAID” followed by a number, such as: RAID 0, RAID 1, RAID 5, RAID 6, RAID 7, RAID 01, RAID 10, RAID 50, RAID 60. Each level has its theoretical advantages and disadvantages, balancing between two goals: increasing data reliability and increasing storage (array) read/write performance.

In simple terms, RAID combines multiple hard drives into a single logical drive, so the operating system treats it as one physical drive. RAID is often used on server computers and typically uses identical drives for the array. Due to the continuous decline in hard drive prices and more effective integration of RAID functionality with motherboards, it has also become an option for ordinary users, especially for tasks requiring large storage capacity, such as video and audio production. ————Source: Wikipedia

Why Use RAID?

Using RAID primarily aims to achieve one or more of the following goals:

  1. Improve Performance: Allow multiple hard drives to read/write data simultaneously, which is much faster than a single drive.
    • It’s like having multiple workers move goods at the same time, much faster than one person.
  2. Increase Fault Tolerance/Reliability: Through data redundancy (backup or parity), even if one drive suddenly fails, data is not lost, and service is not interrupted.
    • It’s like making photocopy backups of important documents; even if the original is lost, the backup is still available.
  3. Expand Capacity: Combine multiple small-capacity drives into one large logical volume for easier management and use.
    • It’s like knocking down walls between small rooms to create one large hall.

** Important Note: RAID is NOT a substitute for regular backups! Its main purpose is to ensure service continuity and data availability. In cases of fire, accidental deletion, virus attacks, etc., data on RAID can still be lost. Therefore, you must adhere to the strategy of “RAID + Regular Backups.”**

Detailed Explanation of Hard Drive Requirements for RAID Levels

  1. RAID 0 (Striping)

    Minimum Drives: 2
    Description: RAID 0 splits data into blocks and writes them alternately across all drives. It provides no redundancy or fault tolerance. If any single drive fails, all data is lost.
    Advantages: Very high read/write performance (all drives work simultaneously).
    Disadvantages: Lowest reliability. The more drives, the higher the overall failure rate.
    Common Use Cases: Scenarios requiring extremely high performance where data is not critical or is temporary, such as graphics rendering cache, game storage drives.

  2. RAID 1 (Mirroring)

    Minimum Drives: 2
    Description: RAID 1 writes complete data to every drive simultaneously, achieving 100% mirroring backup.
    Advantages: Slightly improved read performance, write performance is the same as a single drive. High data security; as long as not all drives fail at once, data is not lost.
    Disadvantages: Low disk space utilization (only 50%), high cost.
    Common Use Cases: Scenarios requiring extremely high data security, such as operating system drives, log files for critical databases.

  3. RAID 5 (Striping with Parity)

    Minimum Drives: 3
    Description: RAID 5 distributes data and parity information across all drives. It can tolerate the failure of any single drive. Usable capacity is (N-1) * single drive capacity.
    Advantages: Excellent balance between capacity, performance, and security. Space utilization is higher than RAID 1.
    Disadvantages: Poor write performance (requires parity calculation). After one drive fails, the array rebuild process is very stressful, time-consuming, and if another drive fails during this period, all data is lost.
    Common Use Cases: Widely used in file sharing servers, small to medium-sized database storage, etc.

  4. RAID 6 (Striping with Double Parity)

    Minimum Drives: 4
    Description: RAID 6 is similar to RAID 5 but uses two different parity algorithms, allowing it to tolerate the simultaneous failure of any two drives. Usable capacity is (N-2) * single drive capacity.
    Advantages: Higher security than RAID 5, especially suitable for arrays with large-capacity drives (long rebuild times, double protection is safer).
    Disadvantages: Write performance is worse than RAID 5 (requires calculating parity twice). Lower space utilization.
    Common Use Cases: Arrays using large-capacity SATA drives, archival storage with extremely high data security requirements.

  5. RAID 10 (Mirroring first, then Striping)

    Minimum Drives: 4 (must be an even number)
    Description: RAID 10 is a combination of RAID 1 and RAID 0. It first pairs drives into RAID 1 mirrored pairs, then combines these pairs into a RAID 0 striped volume.
    Advantages: Combines the high security of RAID 1 with the high performance of RAID 0. Rebuild speed is much faster than RAID 5/6.
    Disadvantages: Highest cost, disk space utilization is only 50%.
    Common Use Cases: Scenarios requiring both high performance and high reliability, such as database servers, virtualization hosts, high-traffic websites.

Important Notes:

  • The above are minimum requirements. Except for RAID 1, other levels can use more than the minimum number of drives (e.g., RAID 5 can use 4, 5, 6… drives; RAID 10 can use 4, 6, 8… drives).
  • Hybrid RAID: There are other RAID levels (like RAID 50, RAID 60, etc.) that are combinations of the basic levels mentioned above and require more drives.
  • Hot Spare: In actual enterprise deployments, one or more hot spare drives are often configured. When a working drive in the array fails, the hot spare automatically replaces it and begins data reconstruction. This process requires no manual intervention, further improving system availability. Hot spares do not participate in daily RAID operations and are not counted in the minimum requirements above.

Common Scenario Examples: Which RAID to Use?

  1. Operating System (OS) Drive and Critical Boot Drive

    • Recommended: RAID 1
      • Reason: The OS drive typically doesn’t require huge capacity but has extremely high availability and reliability requirements. RAID 1 provides the best protection; if one drive fails, the system continues running seamlessly, making it easy to replace the drive and rebuild. Read performance is also improved, aiding system boot and operation.
  2. File Storage Server / NAS

    • Small/Medium-sized, Budget-sensitive: Recommended RAID 5
      • Reason: Achieves a perfect balance between capacity utilization and security. Offers the best cost-performance for servers storing general files like documents and images.
    • Large-scale, using high-capacity drives (e.g., >4TB): Strongly recommended RAID 6
      • Reason: Rebuild times for high-capacity drives are very long (possibly over 24 hours), and the risk of a second drive failing during this period cannot be ignored. RAID 6’s double parity provides crucial safety.
  3. Video Editing / Media Production

    • Raw Footage Storage: Recommended RAID 5/6
      • RAID 5/6: A safer choice, providing sufficient bandwidth while ensuring data security.
    • Finished Product Archiving: Recommended RAID 6
      • Data is important, large in volume, and needs long-term safe storage. RAID 6 is the best choice.

Important things need to be said three times: RAID is not backup! RAID is not backup! RAID is not backup! No matter how secure your RAID is, you must have a strategy for regular backups to other media (such as tape, offsite NAS, cloud storage).