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

RAID block device mapping

Use sysfs to inspect the relationship between virtual RAID devices and members.

In this lesson, you will learn how to use the sysfs filesystem to peek under the hood and map exactly which physical drives are supporting your virtual RAID array.

Beyond the Command Line

While commands like mdadm --detail provide a human-readable summary of your array, the Linux kernel maintains a real-time, hierarchical view of storage devices within /sys. This is known as sysfs. Because Linux treats hardware as a tree of objects, we can traverse this tree to see the relationship between an md (Multiple Device) RAID volume and its underlying block device members.

Inspecting via sysfs

If you have a RAID array named md0, the kernel exposes its topology inside /sys/block/md0/md/. This directory contains symlinks that point directly to the physical block devices participating in the array.

You can explore these mappings easily using ls -l:

# Navigate to the RAID metadata directory
cd /sys/block/md0/md/

# List the dev-* entries
ls -l dev-*

When you run this command, you will see output similar to this: lrwxrwxrwx ... dev-sda -> ../../../block/sda lrwxrwxrwx ... dev-sdb -> ../../../block/sdb

Each dev-* entry is a symbolic link. The name of the link (e.g., dev-sda) tells you the array member, and the pointer (e.g., ../../../block/sda) confirms exactly which physical block device that member maps to in the kernel's device list.

Why this matters

Using sysfs is a powerful way to verify your hardware layout, especially if you are working with virtualized storage or complex disk configurations where /dev/sdX names might change or look ambiguous. Since sysfs is the source of truth for the kernel, it is more reliable than relying solely on configuration files or user-space tools that might be stale. By checking these links, you can confirm that your RAID virtual device is truly built on the physical partitions or disks you intended, ensuring your redundancy and performance are physically grounded where you expect them to be.

Key Takeaway: You can map RAID members to physical devices by inspecting the symlinks within the /sys/block/<array>/md/ directory, which provides an authoritative view of the kernel's device hierarchy.