LinuxCommandLibrary

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
copy
Stop array
$ sudo mdadm --stop /dev/md0
copy
Mark disk failed
$ sudo mdadm --fail /dev/md0 /dev/sda1
copy
Remove disk
$ sudo mdadm --remove /dev/md0 /dev/sda1
copy
Add disk
$ sudo mdadm --assemble /dev/md0 /dev/sdc1
copy
Show details
$ sudo mdadm --detail /dev/md0
copy
Clear RAID metadata
$ sudo mdadm --zero-superblock /dev/sda1
copy

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

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)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community