装配模式(装配能扫描RAID上的元数据,常用于装系统后,重新装配使用)
-A
管理模式
-f标记指定磁盘为损坏
-a添加磁盘
-r移除磁盘
<raiddevice>:/dev/md#
<component-devices>:任意块设备,可以是磁盘,可以是分区。
显示RAID的详细信息
mdadm -D /dev/md5\
查看MD的状态
cat /proc/mdstat
实例创建RAID5: 1,分区设置分区ID fd
[root@localhost /]# fdisk -l |grep "^/dev/sd[a-g]"
/dev/sda1 * 1 26 204800 83 Linux
/dev/sda2 26 7859 62914560 8e Linux LVM
/dev/sdb1 1 654 5253223+ fd Linux raid autodetect
/dev/sdb2 655 1308 5253255 fd Linux raid autodetect
/dev/sdb3 1309 1962 5253255 fd Linux raid autodetect
/dev/sdc1 1 654 5253223+ fd Linux raid autodetect
[root@localhost /]#
2,创建RAID5
[root@localhost testmd5]# mdadm -C /dev/md5 -a yes -n 3 -l 5 -x 1 /dev/sd[b,c][1-3]
mdadm: /dev/sdb1 appears to be part of a raid array:
level=raid5 devices=3 ctime=Wed Aug 26 17:28:15 2015
mdadm: /dev/sdb2 appears to be part of a raid array:
level=raid5 devices=3 ctime=Wed Aug 26 17:28:15 2015
mdadm: /dev/sdb3 appears to be part of a raid array:
level=raid5 devices=3 ctime=Wed Aug 26 17:28:15 2015
mdadm: /dev/sdc1 appears to be part of a raid array:
level=raid5 devices=3 ctime=Wed Aug 26 17:28:15 2015
Continue creating array?
Continue creating array? (y/n) y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md5 started. 3,查看md的状态
[root@localhost testmd5]# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4]
md5 : active raid5 sdb3[4] sdc1[3](S) sdb2[1] sdb1[0]
10498048 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/2] [UU_]
[============>........] recovery = 61.8% (3246400/5249024) finish=1.0min speed=30693K/sec
unused devices: <none> 4,查看RAID信息
[root@localhost testmd5]# mdadm -D /dev/md5
/dev/md5:
Version : 1.2
Creation Time : Wed Aug 26 18:42:00 2015
Raid Level : raid5
Array Size : 10498048 (10.01 GiB 10.75 GB)
Used Dev Size : 5249024 (5.01 GiB 5.38 GB)
Raid Devices : 3
Total Devices : 4
Persistence : Superblock is persistent
Update Time : Wed Aug 26 18:43:27 2015
State : clean
Active Devices : 2
Working Devices : 4
Failed Devices : 0
Spare Devices : 2
Layout : left-symmetric
Chunk Size : 512K
Rebuild Status : 43% complete
Name : localhost.localdomain:5 (local to host localhost.localdomain)
UUID : 7c6efc4f:5f6e0b0d:f6e56836:3556ec3f
Events : 7
Number Major Minor RaidDevice State
0 8 17 0 active sync /dev/sdb1
1 8 18 1 active sync /dev/sdb2
4 8 19 2 spare rebuilding /dev/sdb3
3 8 33 - spare /dev/sdc1 5,格式化挂载。
[root@localhost testmd5]# mkfs.ext4 /dev/md5
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=128 blocks, Stripe width=256 blocks
657072 inodes, 2624512 blocks
131225 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2688548864
81 block groups
32768 blocks per group, 32768 fragments per group
8112 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632