mdadm(8)
Create, manage, and monitor Linux software RAID arrays.
Synopsis
mdadm [mode] [options] [md-device] [component-devices]Description
mdadm is the primary tool for managing MD (multiple disk) RAID devices on Linux. It can create new RAID arrays, add or remove disks, monitor array health, perform recovery operations, and assemble existing arrays at boot time.
RAID levels supported include RAID 0 (striping), RAID 1 (mirroring), RAID 5 (striping with parity), RAID 6 (dual parity), RAID 10, and linear arrays. mdadm can operate in several modes: create, assemble, manage, monitor, grow, and incremental assembly.
Common options
| Flag | What it does |
|---|---|
-C, --create | Create a new RAID array |
-A, --assemble | Assemble a previously created RAID array from component devices |
-M, --manage | Change properties of an active array (add, remove, replace disks) |
-F, --follow, --monitor | Monitor one or more arrays and alert on failure |
-G, --grow | Grow or reshape an array (increase size or change layout) |
-l, --level=LEVEL | Set RAID level (0, 1, 5, 6, 10, linear, multipath) |
-n, --raid-devices=NUM | Set number of active devices in the RAID array |
-p, --parity=TYPE | Set parity algorithm for RAID 5/6 (left-symmetric, left-asymmetric, etc.) |
-c, --chunk=SIZE | Set chunk size in kilobytes (default 512K) |
-f, --fail | Mark a device as faulty within the array |
-r, --remove | Remove a device from the array |
-a, --add | Add a device to an active array |
Examples
Create a new RAID 1 (mirror) array with two devices at /dev/md0
mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1Create a RAID 5 array using four devices
mdadm --create /dev/md0 --level=5 --raid-devices=4 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1Assemble an existing RAID array from its component devices
mdadm --assemble /dev/md0 /dev/sda1 /dev/sdb1Add a new device to an active RAID array
mdadm --manage /dev/md0 --add /dev/sdc1Mark a device as failed and remove it from the array
mdadm --manage /dev/md0 --fail /dev/sda1 --remove /dev/sda1Display detailed status and configuration of a RAID array
mdadm --detail /dev/md0Monitor array health every 300 seconds and email root on problems
mdadm --monitor /dev/md0 --mail root --delay=300Expand RAID array to 5 devices and use maximum available space
mdadm --grow /dev/md0 --raid-devices=5 --size=max