5.阵列的元数据应用
Build模式可以用来创建没有元数据的RAID0/1设备,不能创建RAID4/5/6/10等带有冗余级别的MD设备,而create模式建立的RAID设备都是带有元数据的.以使用命令--examine(-E)来检测当前的块设备上是否有阵列的元数据信息.
[root@server ~]# mdadm -E /dev/sdh1
/dev/sdh1:
Magic : a92b4efc
Version : 00.90.00
UUID : cea9dd57:59f61370:00969939:2ef303d5
Creation Time : Sun May 17 12:15:50 2009
Raid Level : raid5
Used Dev Size : 8385792 (8.00 GiB 8.59 GB)
Array Size : 16771584 (15.99 GiB 17.17 GB)
Raid Devices : 3
Total Devices : 4
Preferred Minor : 2
Update Time : Sun May 17 13:07:43 2009
State : clean
Active Devices : 3
Working Devices : 4
Failed Devices : 0
Spare Devices : 1
Checksum : 95f50002 - correct
Events : 0.2
Layout : left-symmetric
Chunk Size : 64K
Number Major Minor RaidDevice State
this 1 8 113 1 active sync /dev/sdh1
0 0 8 97 0 active sync /dev/sdg1
1 1 8 113 1 active sync /dev/sdh1
2 2 8 129 2 active sync /dev/sdi1
3 3 8 145 3 spare /dev/sdj1
从以上信息可以看到sdg1,sdh1,sdi1和sdj1共同组成了一个raid5设备,sdj1做备份盘,该设备创建于2009 12:15:50,条带数据块大小采用了默认值64k.此外还有一个重要的数据那就是UUID,它是阵列的唯一标识,组成同一阵列的相关磁盘上的UUID是相同的.
可以用以下命令来将具有相同元数据的磁盘重先组装成RAID.
[root@server ~]# mdadm --assemble -v --uuid=cea9dd57:59f61370:00969939:2ef303d5 /dev/md2 /dev/sd[b-j]1
mdadm: looking for devices for /dev/md2
mdadm: /dev/sdb1 has wrong uuid. --1--
mdadm: /dev/sdc1 has wrong uuid.
mdadm: cannot open device /dev/sdd1: Device or resource busy --2--
mdadm: /dev/sdd1 has wrong uuid.
mdadm: cannot open device /dev/sde1: Device or resource busy
mdadm: /dev/sde1 has wrong uuid.
mdadm: cannot open device /dev/sdf1: Device or resource busy
mdadm: /dev/sdf1 has wrong uuid.
mdadm: /dev/sdg1 is identified as a member of /dev/md2, slot 0.
mdadm: /dev/sdh1 is identified as a member of /dev/md2, slot 1.
mdadm: /dev/sdi1 is identified as a member of /dev/md2, slot 2.
mdadm: /dev/sdj1 is identified as a member of /dev/md2, slot 3.
mdadm: added /dev/sdh1 to /dev/md2 as 1
mdadm: added /dev/sdi1 to /dev/md2 as 2
mdadm: added /dev/sdj1 to /dev/md2 as 3
mdadm: added /dev/sdg1 to /dev/md2 as 0
mdadm: /dev/md2 has been started with 3 drives and 1 spare.
--1--,/dev/sdb1与我们命令中的UUID不匹配.
--2--,/dev/sdd1正忙,无法获取到相关UUID.