Skip to content

MD Raid Devices

Get Status

cat /proc/mdstat # This should give you the status on every box
mdadm -Esv # Get the overall status and other information about the array


[email protected]:~# mdadm -Esv
ARRAY /dev/md/127  level=raid0 metadata=1.2 num-devices=2 UUID=f08bed23:a5b4764a:4a7151ad:65cddd4e name=hostymchostface:127



sudo mdadm -Esv
sudo mdadm  --stop /dev/md*
sudo mdadm --misc --scan --detail /dev/md0
sudo mdadm -v --assemble "$array" "$disk1$part" "$disk2$part"

If you're getting mdadm: cannot open /dev/sdb1: Device or resource busy or something like that chances are is that the array isn't created correctly. You will need to stop the array with mdadm --stop /dev/md* and recreate it.

The rest of the troubleshooting commands are for scanning and re-assembling arrays for example you put the disks in the wrong order. It happens to everyone at least once :)

Creating an Array

You can make an array a lot of different ways, the current best way is with LVM & DMRAID; however there are A LOT of cases where MDRaid is better to use. A good example is with compatibly with hardware controllers. Dell's PERC orders and creates it's discs in a way that is compatible with importing and exporting via Linux MD devices.


mdadm --create /dev/md127 --level=stripe --raid-devices=2 --chunk=16 /dev/sdb1 /dev/sdc1

This example creates a MD device /dev/md127 the level is stripe meaning it is striping the data aka RAID0. The raid-devices and chunk are the chunk aka strip size and the number of disks in the array. In this case /dev/sdb1 /dev/sdc1 are the two disks in the example. You can configure this as needed


man mdadm

Rebuilding an Array