mdadm命令

mdadm 主要命令说明模式(7种):

•Assemble:加入一个以前定义的阵列

•Build:创建一个没有超级块的阵列

•Create:创建一个新的阵列,每个设备具有超级块

•Manage: 管理阵列(如添加和删除)

•Misc:允许单独对阵列中的某个设备进行操作(如停止阵列)

•Follow or Monitor:监控RAID的状态

•Grow:改变RAID的容量或阵列中的设备数目

选项:
-A, --assemble:加入一个以前定义的阵列
-B, --build:创建一个没有超级块的阵列(Build a legacy array without superblocks.)
-C, --create:创建一个新的阵列
-F, --follow, --monitor:选择监控(Monitor)模式
-G, --grow:改变激活阵列的大小或形态
-I, --incremental:添加一个单独的设备到合适的阵列,并可能启动阵列
--auto-detect:请求内核启动任何自动检测到的阵列
-h, --help:帮助信息,用在以上选项后,则显示该选项信息
--help-options:显示更详细的帮助
-V, --version:打印mdadm的版本信息
-v, --verbose:显示细节
-b, --brief:较少的细节。用于 --detail 和 --examine 选项
-Q, --query:查看一个device,判断它为一个 md device 或是 一个 md 阵列的一部分
-D, --detail:打印一个或多个 md device 的详细信息
-E, --examine:打印 device 上的 md superblock 的内容
-c, --config= :指定配置文件,缺省为 /etc/mdadm.conf
-s, --scan:扫描配置文件或 /proc/mdstat以搜寻丢失的信息。配置文件/etc/mdadm.conf


-C 创建Raid (/dev/md0是我的raid名称)
-n 磁盘阵列个数

-l raid的级别,-x hostspare,待机磁盘,

--size 指定每块磁盘大小

--add         -a   : hotadd subsequent devices to the array
--remove      -r   : remove subsequent devices, which must not be active
--fail        -f   : mark subsequent devices a faulty
--set-faulty       : same as --fail
--run         -R   : start a partially built array
--stop        -S   : deactivate array, releasing all resources
--readonly    -o   : mark array as readonly
--readwrite   -w   : mark array as readwrite


Options that are valid with management mode are:
--add         -a   : hotadd subsequent devices to the array
--remove      -r   : remove subsequent devices, which must not be active
--fail        -f   : mark subsequent devices a faulty
--set-faulty       : same as --fail
--run         -R   : start a partially built array
--stop        -S   : deactivate array, releasing all resources
--readonly    -o   : mark array as readonly
--readwrite   -w   : mark array as readwrite

使用cat /proc/mdstat命令来查看一下RAID的状态
配置完后,需mdadm -D --scan>/etc/mdadm.conf 进行配置更新