之前在 XenServer 6.2 下用的挺好的软 raid5,重装了系统到 XenServer 6.5 版,不认 raid5 了,用 mdadm 重新创建,错误提示如下:
[root@vms-67 ~]# mdadm --create --verbose /dev/md0 -l 5 -n 3 -x 0 /dev/sdb1 /dev/sdc1 /dev/sdd1 mdadm: layout defaults to left-symmetric mdadm: layout defaults to left-symmetric mdadm: chunk size defaults to 512K mdadm: /dev/sdb1 appears to be part of a raid array: level=raid0 devices=0 ctime=Thu Jan 1 08:00:00 1970 mdadm: partition table exists on /dev/sdb1 but will be lost or meaningless after creating array mdadm: /dev/sdc1 appears to be part of a raid array: level=raid0 devices=0 ctime=Thu Jan 1 08:00:00 1970 mdadm: partition table exists on /dev/sdc1 but will be lost or meaningless after creating array mdadm: /dev/sdd1 appears to be part of a raid array: level=raid0 devices=0 ctime=Thu Jan 1 08:00:00 1970 mdadm: partition table exists on /dev/sdd1 but will be lost or meaningless after creating array mdadm: size set to 173378560K Continue creating array? yes mdadm: unexpected failure opening /dev/md0
经过百度,找不到有关“unexpected failure”的任何记录,于是猜想了各种可能,测试了半天,无论创建多少分区,多大容量,问题依旧,没办法。。。。。看来这类问题还要问谷歌,于是立即发现解决方案如下:
XenServer 6.5 do not load soft raid kernel modules on boot. (See comments by Roland Monday on this article). My solution is: 1. Create file /etc/sysconfig/modules/raid.modules with needed modules # echo "modprobe raid1" > /etc/sysconfig/modules/raid.modules you can add lines for another raid level (raid0 or raid10 for example) 2. Make this file executable # chmod +x /etc/sysconfig/modules/raid.modules 3. Reboot. PS: I do not know will this changes survive after installing patches
原文来自: http://discussions.citrix.com/topic/360943-software-raid-mdadm-on-xenserver-65-unexpected-failure/
原来 XenServer 6.5 启动时没有自动加载 raid 模块,按照上面的步骤,将 raid5 加入 /etc/sysconfig/modules/raid.modules ,重启后搞定:
[root@vms-67 ~]# mdadm --create --verbose /dev/md0 -l 5 -n 3 -x 0 /dev/sdb1 /dev/sdc1 /dev/sdd1 mdadm: layout defaults to left-symmetric mdadm: layout defaults to left-symmetric mdadm: chunk size defaults to 512K mdadm: /dev/sdb1 appears to be part of a raid array: level=raid5 devices=3 ctime=Tue Aug 10 20:46:13 2010 mdadm: partition table exists on /dev/sdb1 but will be lost or meaningless after creating array mdadm: /dev/sdc1 appears to be part of a raid array: level=raid5 devices=3 ctime=Tue Aug 10 20:46:13 2010 mdadm: partition table exists on /dev/sdc1 but will be lost or meaningless after creating array mdadm: /dev/sdd1 appears to be part of a raid array: level=raid5 devices=3 ctime=Tue Aug 10 20:46:13 2010 mdadm: partition table exists on /dev/sdd1 but will be lost or meaningless after creating array mdadm: size set to 976628736K Continue creating array? yes mdadm: Defaulting to version 1.2 metadata mdadm: array /dev/md0 started.
查看建立进度:
[root@vms-67 ~]# cat /proc/mdstat Personalities : [raid6] [raid5] [raid4] md0 : active raid5 sdd1[3] sdc1[1] sdb1[0] 1953257472 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/2] [UU_] [>....................] recovery = 0.1% (1687840/976628736) finish=144.3min speed=112522K/sec unused devices: <none>
一切搞定,等待同步完成吧。
最后一步,别忘了生成配置文件(/etc/mdadm.conf),否则重启后查看 raid 又没了,我第一次重启就犯了这个错误。。。:
# mdadm -D -s >/etc/mdadm.conf
总结:搞技术必须翻墙用谷歌。