When using Intel hardware fake raid there are possibilities you will be stuck at dracut shell after changing the harddisk on Centos 7. However, supposed we can still boot the server by typing ‘exit’ command. How to know if the server using fake raid? If your server using ‘Intel Rapid Storage Technology’ most probably you are using fake raid(imsm). The raid rebuilding will be done from within the OS.
To check if you are using fake raid run the below command;
[[email protected] ~]# cat /proc/mdstat Personalities : [raid1] md126 : active raid1 sda[1] sdb[0] 3711641600 blocks super external:/md127/0 [2/2] [UU] md127 : inactive sdb[1](S) sda[0](S) 10402 blocks super external:imsm unused devices: <none> [[email protected] ~]#
Why it happens?
Actually, after change the harddisk of the failed raid, the UUID for the raid device will change. That is why the boot stuck at dracut shell. It just failed to boot to root device because bootloader point to the old UUID of the device. Supposed we can still boot the server by using ‘exit’ command.
What we need to do?
1. Change /etc/mdadm.conf to the new UUID of the raid. The below command will do, but you just need to remove the existing UUID first.
[[email protected] ~]# mdadm --detail --scan ARRAY /dev/md/imsm0 metadata=imsm UUID=1c8e5b8a:3df25b8c:28c3f3fa:21871fe2 ARRAY /dev/md/Volume0 container=/dev/md/imsm0 member=0 UUID=7fdecf95:90b7eab7:4ca6039a:a65fb3a3 [[email protected] ~]#
In my case, I just comment it out. ‘cat’ is not the command to edit the file.
[[email protected] ~]# cat /etc/mdadm.conf # mdadm.conf written out by anaconda MAILADDR root AUTO +imsm +1.x -all #ARRAY /dev/md/Volume0_0 UUID=06e7381e:1127a1dd:0f8e52f3:b8e51cc2 #ARRAY /dev/md/imsm0 UUID=ca3d7504:3f9d43a2:fe09cab6:5c4be3ed ARRAY /dev/md/imsm0 metadata=imsm UUID=ca3d7504:3f9d43a2:fe09cab6:5c4be3ed ARRAY /dev/md/Volume0 container=/dev/md/imsm0 member=0 UUID=c0718acf:a2049099:004a8192:7b39b033
Double check the UUID;
[[email protected] ~]# mdadm --detail /dev/md126 /dev/md126: Container : /dev/md/imsm0, member 0 Raid Level : raid1 Array Size : 3711641600 (3.46 TiB 3.80 TB) Used Dev Size : 3711641600 (3.46 TiB 3.80 TB) Raid Devices : 2 Total Devices : 2 State : active Active Devices : 2 Working Devices : 2 Failed Devices : 0 Spare Devices : 0 Consistency Policy : resync UUID : 7fdecf95:90b7eab7:4ca6039a:a65fb3a3 Number Major Minor RaidDevice State 1 8 0 0 active sync /dev/sda 0 8 16 1 active sync /dev/sdb
2. Update grub to new UUID.
Next is to update the UUID in grub bootloader.
[[email protected] ~]# grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file … Found linux image: /boot/vmlinuz-3.10.0-962.3.2.lve1.5.63.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-962.3.2.lve1.5.63.el7.x86_64.img Found linux image: /boot/vmlinuz-3.10.0-962.3.2.lve1.5.44.3.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-962.3.2.lve1.5.44.3.el7.x86_64.img Found linux image: /boot/vmlinuz-3.10.0-962.3.2.lve1.5.42.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-962.3.2.lve1.5.42.el7.x86_64.img Found linux image: /boot/vmlinuz-3.10.0-962.3.2.lve1.5.28.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-962.3.2.lve1.5.28.el7.x86_64.img Found linux image: /boot/vmlinuz-3.10.0-962.3.2.lve1.5.26.5.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-962.3.2.lve1.5.26.5.el7.x86_64.img Found linux image: /boot/vmlinuz-0-rescue-40d3fa56d85044c99061b7a829c17694 Found initrd image: /boot/initramfs-0-rescue-40d3fa56d85044c99061b7a829c17694.img done
3. Reboot.