Cannot install grub to RAID1 (md0)
Solution 1:
The warning points out the root cause. The new disk that you used for the replacement probably used to have a filesystem on it and grub-setup
is now confused by the metadata that is probably still in there.
So, just wipe out everything at the beginning of the disk up to the first partition. I took the 62
number from the fdisk -l
output. It says that 63
is the start of the first partition, which sounds like there are 62
sectors before it that you can clean out.
dd if=/dev/zero of=/dev/sda bs=512 count=62
Then recreate the partition table:
sfdisk -d /dev/sdb | sfdisk /dev/sda
sfdisk will probably complain about "the kernel may be using the old partition table" but you can ignore the warning since you are not really changing the partition table.
Then you should be able to grub-install /dev/sda
.
Update:
If you are still getting errors, try taking the disk out of the RAID and zeroing out more data from the beginning and the end. Or just zero out the whole disk (dd if=/dev/zero of=/dev/sda
). Then add it back to the RAID as you did before, starting from sfdisk -d /dev/sdb | sfdisk /dev/sda
. And consider switching to metadata format 1.0 as was recommended in a few other places.