/proc/mdstat /proc/mdstat

/proc/mdstat is a special file that shows you the state of the Linux kernel’s md driver. md (multiple device) driver is the software RAID implementation that allows you to create any number of RAID devices based on the disk devices (physical or virtual) available to your Linux system.

Using /proc/mdstat

You can use /proc/mdstat to quickly Identify RAID Arrays in Linux or confirm RAID rebuilding progress.

Simply cat /proc/mdstat file to get the summary of configuration:

[email protected]:~$ cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
md3 : active raid6 sdh6[8] sda6[0] sdg6[6] sdf6[5] sde6[4] sdd6[3] sdc6[2] sdb6[1]
17581481472 blocks super 1.2 level 6, 64k chunk, algorithm 2 [8/8] [UUUUUUUU]

md2 : active raid6 sdh5[15] sda5[9] sdg5[14] sdf5[8] sde5[13] sdd5[12] sdc5[11] sdb5[10]
17552612736 blocks super 1.2 level 6, 64k chunk, algorithm 2 [8/8] [UUUUUUUU]

md1 : active raid1 sdh2[7] sda2[0] sdb2[1] sdc2[2] sdd2[3] sde2[4] sdf2[5] sdg2[6]
2097088 blocks [8/8] [UUUUUUUU]

md0 : active raid1 sdh1[7] sda1[0] sdb1[1] sdc1[2] sdd1[3] sde1[4] sdf1[5] sdg1[6]
2490176 blocks [8/8] [UUUUUUUU]

/proc/mdstat output

mdstat personalities

The first line of the output confirms all the software RAID levels supported by your md driver

md devices

Usually starting with md0 or md127, these devices (md0, md1, md2 and md3 in the output above) are the actual RAID arrays configured. Each of these devices (if healthy) is presented as a single storage device that you can format, mount, etc.

After the name of an md device, you see the status (active means it’s online and healthy) of your array and the list of devices that belong to that array.

This above is the output from my 8-bay Synology NAS server, so I have 8 disks in each software RAID device.

IMPORTANT: you don’t need to use full devices when adding them to a RAID array. You can always partition each physical disk, and then create different RAID arrays using different partitions. That’s exactly what you can see in the output above: Synology has “only” 8 physical disks, but each is partitioned so m23 is created using partition 6 (sdh6 ,sda6, etc), md2 is using partitions 5 (sdh5, sda5, etc) while md1 users partition 2 (sdh2, sda2) and md0 uses partitions with number 1 on each of the physical disks.

For each md device you get the raid personality confirmed (raid6 or raid1 after the “active” status word for each mdX device).

Device status in each md array

  • 8 devices are up (that’s what each of the Us mean in the [UUUUUUUU] section)
    • if some disks were failing, we’d see the underscore indication which of the disks is offline. [_UUUUUUU] would mean first disk (sdh6 for md3) is faulty. [U_UUUUUU] would mean the next one after is failing: probably sda6.

See Also

Keep Learning with Me

Follow me on Facebook and Twitter or jump into Telegram chat!:
Recommended Software
I use Brave browser, it's awesome: Brave Browser I'm also a fan of SetApp for macOS: SetApp for macOS
IT Consultancy
I'm a principal consultant with Tech Stack Solutions. I help with cloud architectrure, AWS deployments and automated management of Unix/Linux infrastructure. Get in touch!
Recent Articles
18 Jun 2021

CentOS 8.4 Released

17 Jun 2021

yum/dnf Package Manager Basics

28 May 2021

Keychron K3

Recent Tweets