← 返回命令列表

Linux command

mdadm 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

Create

sudo mdadm --create /dev/md/MyRAID --level raid1 --raid-devices 2 /dev/sda1 /dev/sdb1

Stop

sudo mdadm --stop /dev/md0

Example

sudo mdadm --fail /dev/md0 /dev/sda1

Remove

sudo mdadm --remove /dev/md0 /dev/sda1

Add

sudo mdadm --assemble /dev/md0 /dev/sdc1

Example

sudo mdadm --detail /dev/md0

Clear

sudo mdadm --zero-superblock /dev/sda1

说明

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.

参数

--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

FAQ

What is the mdadm command used for?

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.

How do I run a basic mdadm example?

Run `sudo mdadm --create /dev/md/MyRAID --level raid1 --raid-devices 2 /dev/sda1 /dev/sdb1` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --create _device_ do in mdadm?

Create a new array