In this example we have 2 drives in a RAID array and /dev/sdb is the one that failed. /dev/sda1 is also the /boot partition which we tell grub to install on /dev/sdb eg install root (hd0,0) /dev/sda1 on the new drive /dev/sdb (hd1)
First copy the partition table from /dev/sda to /dev/sdb
dd if=/dev/sda of=/dev/sdb bs=512 count=1
Run partprobe to detect the new partition table
partprobe
Add the partitions of the replacement drive /dev/sdb back to the array
mdadm --manage /dev/md0 -a /dev/sdb1
mdadm --manage /dev/md1 -a /dev/sdb2
mdadm --manage /dev/md2 -a /dev/sdb3
Install grub on the new drive
grub
root (hd0,0)
setup (hd1)
mdadm, rebuilding, array, centos, raid, dev, sdb, sda, partition, grub, install, eg, hd, dd, bs, partprobe, detect, partitions, replacement, md,