mdadm

manages Linux software RAID arrays

TLDR

Create RAID array
$ sudo mdadm --create /dev/md/MyRAID --level raid1 --raid-devices 2 /dev/sda1 /dev/sdb1
Stop array
$ sudo mdadm --stop /dev/md0
Mark disk failed
$ sudo mdadm --fail /dev/md0 /dev/sda1
Remove disk
$ sudo mdadm --remove /dev/md0 /dev/sda1
Add disk
$ sudo mdadm --assemble /dev/md0 /dev/sdc1
Show details
$ sudo mdadm --detail /dev/md0
Clear RAID metadata
$ sudo mdadm --zero-superblock /dev/sda1

SYNOPSIS

mdadm [mode] [OPTIONS] device

DESCRIPTION

mdadm manages Linux software RAID arrays (md devices). It can create, assemble, monitor, grow, and manage arrays of various RAID levels including RAID 0, 1, 5, 6, and 10.

PARAMETERS

--create device

Create a new array
--assemble device
Assemble a previously created array
--stop device
Stop an active array
--detail device
Display detailed information about an array
--examine device
Examine RAID superblock on a component device
--fail device component
Mark a component as failed
--remove device component
Remove a component from an array
--add device component
Add a component to an array
--level level
RAID level (0, 1, 5, 6, 10, linear)
--raid-devices n
Number of active devices in array
--zero-superblock device
Erase RAID superblock from a device

INSTALL

sudo apt install mdadm
sudo dnf install mdadm
sudo pacman -S mdadm
sudo apk add mdadm
sudo zypper install mdadm
nix profile install nixpkgs#mdadm

CAVEATS

Creating an array destroys existing data on component devices. RAID is not a backup solution. RAID 5/6 require minimum 3/4 devices respectively. Always monitor arrays for failed drives.

HISTORY

mdadm is the modern Linux software RAID management tool, replacing older raidtools.

SEE ALSO

lsblk(8), blkid(8)