centos 7 raid5 rebuild + grub from live ubuntu 18.04 rescue env

sudo su -
modprobe raid5
mdadm --stop /dev/md0
mdadm --stop /dev/md1
stop any other active md device (you can see them in /prod/mdstat)
mdadm --stop /dev/md127
mdadm --stop /dev/md126
check if they are all stopped
cat /proc/mdstat
run a new scan
mdadm --assemble --scan
check if the raid5 is properly detected
cat /proc/mdstat
copy over the partition tables from working disk (sdc here) to the new disk (sdb here)
sfdisk -d /dev/sdc | sfdisk /dev/sdb
add the devices to their corresponding arrays (start with the /boot one if you have a dedicated boot one)
mdadm /dev/md126 -a /dev/sdb2
mdadm /dev/md127 -a /dev/sdb3
now let’s get ready to fix grub on the new disk, in our example md126 is boot, md127 is /
mkdir /mnt-boot
mount /dev/md126 /mnt
mount /dev/md127 /mnt-boot
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
mount --bind /mnt-boot /mnt/boot
chroot /mnt
you may get an error when doing the chroot if the shell is on a different path. this works for default centos install
chroot /mnt /usr/bin/bash
install grub on all the disks
grub2-install /dev/sda
grub2-install /dev/sdb
grub2-install /dev/sdc
regenerate grub.cfg
grub2-mkconfig > /boot/grub2/grub.cfg
now monitor the progress of the array rebuild process and reboot once completed
watch cat /proc/mdstat