I was in the situation where the primary disk (hda) had dropped out of the RAID arrays it was in due to seek errors so needed to replace the primary disk.
Needed to install the boot loader onto the secondary disk as no doubt it hadn’t been setup.
Tried the grub-install command:
Thinking that this would do everything required I rebooted and took the primary disk out. The machie started booting up and then it kept printing to the screen “grub grub grub……”. Obviously not right so put the primary disk back in and rebooted.
This time ran the following:
grub>device (hd0) /dev/hdc
Then I rebooted and removed the primary disk… this time it booted up fine so I added the new disk.
Partition the new disk:
Â fdisk -l /dev/hdc
And create the same partitions on the new machine.
sfdisk -d /dev/hdc | sfdisk /dev/hda
Or manually using fdisk.
Re-add the disks using mdadm…
mdadm /dev/md0 -a /dev/hda1