Operations 15 min read

Master RAID on Linux: From Basics to Building and Managing RAID10

This guide explains what RAID is, outlines the benefits of different RAID levels, compares hardware and software implementations, and provides a step‑by‑step Linux tutorial for creating, monitoring, repairing, and removing a RAID10 array using mdadm.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master RAID on Linux: From Basics to Building and Managing RAID10

What is RAID (Redundant Array of Independent Disks)

It is a large‑capacity disk group composed of multiple independent disks.
Disk RAID is simply the combination of many hard drives into a single logical unit.
Different RAID levels provide different functions such as speeding up I/O or providing data backup.

Functions of RAID technology

- Improves I/O performance through parallel read/write.
- Increases durability by using redundancy algorithms.
- Provides redundancy while reducing cost.

RAID levels and their differences

- raid0
  Minimum disks: 2
  Advantages: performance boost (read/write speed). Data striped across disks.
  Disadvantages: no redundancy, data loss if any disk fails.
  Use cases: live streaming, IPTV, edge VOD servers.

- raid1
  Minimum disks: 2
  Advantages: fault tolerance, simple recovery, improved read performance, data backup.
  Disadvantages: lower usable capacity (≈50%), slower writes.
  Use cases: servers where data safety is critical.

- raid5
  Minimum disks: 3
  Advantages: fault tolerance and I/O boost (less than RAID0).
  Disadvantages: parity overhead reduces write performance.
  Ideal for: file storage and application servers.

- raid6
  Minimum disks: 4
  Advantages: higher redundancy than RAID5, better read performance.
  Disadvantages: parity overhead further reduces write speed.
  Ideal for: large file storage and application servers.

- raid10
  Minimum disks: 4
  Advantages: very high performance and fault tolerance.
  Disadvantages: low usable capacity (≈50%), higher cost, limited scalability.
  Ideal for: high‑load database servers.

The main differences among RAID levels are read/write speed, fault‑tolerance capability, and cost of deployment.

RAID0

At least two disks are required.
Data is striped across disks, giving high read/write performance and 100% storage utilization.
No redundancy – a single disk failure makes data unrecoverable.
Typical scenario: high‑performance storage where data safety is not critical (e.g., audio/video files).

RAID1

At least two disks are required.
Data is mirrored (one copy on each disk), providing high reliability; usable capacity is about 50%.
Read performance is good, but writes are slower because data must be written to both disks.
If one disk fails, the other continues to serve data.
Typical scenario: systems where data safety is essential, such as mail or transaction servers.

RAID10

RAID10 combines RAID1 and RAID0.
Minimum disks: 4.
Two disks form a mirrored pair (RAID1); two such pairs are then striped (RAID0).
Provides both redundancy and high performance.
Usable capacity is about 50% and cost is relatively high.
If a failed disk is not in the same mirrored pair, the array continues to operate.
Thus RAID10 is often the most practical solution for high‑load database servers.

Summary of RAID levels

Hardware RAID vs Software RAID

Hardware RAID uses a dedicated RAID controller card, offering higher stability and independence from the operating system.
Software RAID is implemented by the OS and utilities; it is generally less stable and depends on the OS kernel.

Practical RAID10 implementation (software RAID)

Environment preparation: add four disks and create a RAID10 array.

# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   20G  0 disk /boot
├─sda1            8:1    0    1G  0 part /boot
└─sda2            8:2    0   19G  0 part
  ├─centos-root 253:0    0   18G  0 lvm /
  └─centos-swap 253:1    0    1G  0 lvm [SWAP]
sdd               8:48   0   10G  0 disk
sde               8:64   0   10G  0 disk
sdf               8:80   0   10G  0 disk
sdg               8:96   0   10G  0 disk

Install mdadm (software RAID tool):

# yum install mdadm -y

Parameter illustration (image omitted for brevity).

Create the RAID10 array:

# mdadm -Cv /dev/md0 -a yes -n 4 -l 10 /dev/sdd /dev/sde /dev/sdf /dev/sdg
mdadm: layout defaults to n2
mdadm: chunk size defaults to 512K
mdadm: size set to 10476544K
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.

View RAID10 information:

# fdisk -l /dev/md0
Disk /dev/md0: 21.5 GB, 21455962112 bytes, 41906176 sectors
Units = sectors of 1 * 512 = 512 bytes
I/O size (minimum/optimal): 524288 bytes / 1048576 bytes
# Note: four 10 GB disks give ~40 GB raw, but RAID10 uses only 50% → 21.5 GB usable.

Create filesystem and mount:

# mkfs.xfs /dev/md0
# mount /dev/md0 /md0_disk/
# df -h

Write test data:

# touch /yuchao-linux/learn-linux.txt
# ls /yuchao-linux/
learn-linux.txt

Removing a failed disk

# mdadm /dev/md0 -f /dev/sdd
mdadm: set /dev/sdd faulty in /dev/md0

Check array status (shows degraded state and one failed device).

# mdadm -D /dev/md0
... State : clean, degraded ...
Failed Devices : 1

Re‑adding the replaced disk

Steps:

# umount /dev/md0
# reboot
# mdadm /dev/md0 -a /dev/sdd
# mdadm -D /dev/md0
... State : clean, degraded, recovering ...
Rebuild Status : 6% complete

After rebuild finishes, the array returns to a clean state with all four devices active.

Deleting the software RAID

# umount /dev/md0
# mdadm -S /dev/md0
# mdadm --misc --zero-superblock /dev/sdb
# mdadm --misc --zero-superblock /dev/sdc
# mdadm --misc --zero-superblock /dev/sdd
# mdadm --misc --zero-superblock /dev/sde
# rm -f /etc/mdadm.conf
# edit /etc/fstab to remove the /dev/md0 entry

Optionally, create partitions and a filesystem on the individual disks (images omitted).

Source: https://www.cnblogs.com/btcm409181423/p/18008555 (copyright belongs to the original author)

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.

LinuxstorageSystem AdministrationRAIDmdadmRAID10
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.