Fundamentals 9 min read

Mastering RAID: A Complete Guide to Disk Array Types and Linux mdadm Commands

This article introduces RAID fundamentals, compares common RAID levels (0, 1, 5, 10), explains their performance and fault‑tolerance characteristics, and provides step‑by‑step Linux mdadm commands to create, inspect, and manage a RAID‑5 array, including simulating disk failures and recovery.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Mastering RAID: A Complete Guide to Disk Array Types and Linux mdadm Commands

1 Introduction to Disk Arrays

RAID (Redundant Array of Independent Disks) combines many inexpensive disks into a large logical unit using either hardware (RAID card) or software (mdadm). It improves performance, fault tolerance, and capacity by striping data across multiple drives. The array appears to the operating system as a single disk.

2 RAID Classification

RAID has many types; this section illustrates four common examples.

RAID Type

Description

Minimum Disks

Space Utilization

Pros & Cons

RAID0

Striped volume

2+

100%

High read/write speed, no fault tolerance

RAID1

Mirrored volume

2

50%

Average speed, provides fault tolerance

RAID5

Striped with parity

3+

(n-1)/n

Fast, fault tolerant, can survive one disk failure

RAID10

Mirror (RAID1) + Stripe (RAID0)

4

50%

Fast and fault tolerant

RAID relies on three key concepts: Mirroring, Data Striping, and Data Parity.

2.1 RAID0

RAID0 uses data striping across two or more disks of equal size, delivering 100% capacity utilization and high I/O performance, but it provides no redundancy—any disk failure results in total data loss.

2.2 RAID1

RAID1 mirrors data on two disks, offering fault tolerance at the cost of 50% usable capacity; read/write speed is moderate because data is written to both disks simultaneously.

2.3 RAID5

RAID5 stores parity information to allow reconstruction of lost data when a single disk fails. Parity can be distributed across disks, reducing overhead compared to mirroring, but it requires significant CPU resources and typically hardware RAID controllers for optimal performance.

Hot spare support enables automatic recovery.

2.4 RAID10

RAID10 combines mirroring and striping: pairs of disks are mirrored, then the mirrors are striped. It tolerates a single disk failure per mirrored pair while maintaining high performance.

3 Demonstration

3.1 mdadm Command

mdadm is the Linux utility for creating and managing software RAID arrays.

option:
-a    detect device name
-n    specify device count
-l    specify RAID level
-C    create
-v    show progress
-f    simulate device failure
-r    remove device
-Q    view summary info
-D    view detailed info
-S    stop RAID array
-x    number of hot spares

3.2 RAID5 Demonstration

# Install mdadm
# First step: list disks
ls /dev/sd*
# Second step: create RAID5 array
mdadm -Cv /dev/md0 -l 5 -n 3 -x 1 /dev/sd{b,c,d,e}
# Third step: view array info
mdadm -D /dev/md0
# Fourth step: format filesystem
mkfs.xfs /dev/md0
# Fifth step: mount
mkdir /du
mount /dev/md0 /du
# Sixth step: simulate disk failure
mdadm /dev/md0 -f /dev/sdc
# Seventh step: view array status after failure
mdadm -D /dev/md0
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxstorageTutorialRAIDdisk arraymdadm
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.