问题

在 CentOS/RHEL 6 机器上更换了故障磁盘。
RAID1 已重建,服务器已重新启动。
重新启动后,磁盘从 RAID 中移除/不同步。
每次重新启动后都必须重建 RAID。

重新启动前重建 RAID。

# mdadm --detail /dev/md1
/dev/md1:
Version : 0.90
Creation Time : Fri Nov 8 10:20:51 2013
Raid Level : raid1
Array Size : 488279488 (465.66 GiB 500.00 GB)
Used Dev Size : 488279488 (465.66 GiB 500.00 GB)
Raid Devices : 2
Total Devices : 2
Preferred Minor : 1
Persistence : Superblock is persistent
Update Time : Thu Jan 7 09:15:04 2016
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
UUID : 1e712c78:0c3dc259:9acdafa7:d4878cfe
Events : 0.2962397
Number Major Minor RaidDevice State
0 67 2 0 active sync /dev/sdaw2
1 67 18 1 active sync /dev/sdax2

重启后 /dev/sdaw2 被删除:

# mdadm --detail /dev/md1
/dev/md1:
version : 0.90
creation time : fri Nov 8 10:20:51 2013
raid level : raid1
array size : 488279488 (465.66 gib 500.00 gb)
used dev size : 488279488 (465.66 gib 500.00 gb)
raid devices : 2
total devices : 1
preferred minor : 1
persistence : superblock is persistent
update time : fri Jan 8 17:53:04 2016
state : active, degraded
active devices : 1
working devices : 1
failed devices : 0
spare devices : 0
uuid : 1e712c78:0c3dc259:9acdafa7:d4878cfe
events : 0.2976471
number major minor raiddevice state
0 0 0 0 removed
1 67 18 1 active sync /dev/sdax2
# cat /etc/mdadm.conf
array /dev/md1 level=raid1 num-devices=2 metadata=0.90 uuid=1e712c78:0c3dc259:9acdafa7:d4878cfe
devices=/dev/sdaw2,/dev/sdax2
array /dev/md0 level=raid1 num-devices=2 metadata=0.90 uuid=5e7743f6:b2efa5e2:7a28469a:06cda6cd
devices=/dev/sdaw1,/dev/sdax1
CentOS/RHEL重新启动后 RAID1 磁盘被移除/不同步
on  It Road.com

解决方案

initramfs 没有从 /etc/mdadm.conf 中选择最新的配置。

注意:必须重新创建 initramfs。
此外,该过程需要重新启动系统。

  1. 检查“mdadm -detail /dev/mdX”(mdX 将是 RAID 设备名称)并确保设备状态为“干净”且磁盘处于“主动同步”模式
mdadm --detail /dev/mdX
  1. 备份现有的 initramfs:
# mv /boot/initramfs-2.6.39-400.264.13.el6uek.x86_64.img /tmp/      ### example kernel, version may differ
  1. 用 dracut 重新创建 initramfs:
# dracut -f /boot/initramfs-2.6.39-400.264.13.el6uek.x86_64.img 2.6.39-400.264.13.el6uek.x86_64
  1. 重新启动系统。
# shutdown -r now
日期:2020-09-17 00:14:08 来源:oir作者:oir