Course contentsShow
← Linux
Lesson 688 of 1,8197. Storage Management and Logical VolumesFree lesson

Software RAID (mdadm) architecture

Understand the kernel-level software RAID implementation and its hardware abstraction.

In this lesson, you will learn how the Linux kernel implements software RAID using the md (Multiple Device) driver to abstract physical storage.

Understanding the md Layer

While you have used LVM to handle volume management, Linux provides a dedicated subsystem for redundancy and performance called md. When you use the mdadm utility, you aren't just creating a configuration file; you are instructing the Linux kernel to create a virtual "block device" that sits between your filesystem and your physical disks.

Think of the md driver as a traffic controller. When you write data to an md device (e.g., /dev/md0), the driver intercepts that write request and decides how to distribute it across the underlying physical disks based on the RAID level you’ve chosen.

Hardware Abstraction

The genius of this architecture is that the kernel treats the md device as a single, standard disk. Because it creates a block-level abstraction, the filesystem sitting on top of /dev/md0 (like ext4 or XFS) doesn't even know it's talking to multiple disks; it only sees one large, reliable volume.

For example, if you create a RAID 1 (mirroring) array, the kernel handles the duplication at the block level:

# Example: Creating a mirror across two physical partitions
mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1

In this setup, the md driver presents /dev/md0 to the OS. If a write occurs, the kernel driver synchronously sends that data to both /dev/sdb1 and /dev/sdc1. If one drive fails, the kernel driver simply reroutes requests to the remaining healthy disk.

Why not just use LVM RAID?

While LVM has "RAID-like" capabilities, mdadm operates at a lower, more fundamental level of the kernel stack. Because the md driver is purpose-built solely for array management, it is often considered the gold standard for pure redundancy and performance tuning, offering deep control over recovery synchronization speeds and component health monitoring that exists independently of your LVM volume group structure.

Key Takeaway: The md driver acts as a kernel-level traffic manager that creates a virtual block device, hiding the complexity of multiple disks from the filesystem and ensuring data redundancy through low-level hardware abstraction.