How to fix a raid1 mirrored boot disk with a failed single disk.


=====================

Getting Info

=====================

mdadm --detail /dev/md0

cat /proc/mdstat


fdisk -l

lsblk



=====================

Recovery Steps

=====================

Assume the mirrored disks are  /dev/sda and /dev/sdb  and

/dev/sdb disk  failed


# may not be needed as the failed disk is already marked failed and removed 

mdadm --manage /dev/md0 --fail /dev/sdb2

mdadm --manage /dev/md0 --remove /dev/sdb2


# physically replace /dev/sdb   then mirror the partition table

shutdown the system and replace the failed disk, then do

sfdisk -d /dev/sda | sfdisk /dev/sdb


# check

fdisk -l


# add new disk to mirror disk  md0

mdadm --manage /dev/md0 --add /dev/sdb2


# check and track progress of sync

cat /proc/mdstat



# After the raid completes, make  /dev/sdb  bootable also.

# If this is not a boot disk, then skip.

grub-install /dev/sdb

update-grub /dev/sdb