CentOS 8.x Software raid try to recover failed raid device

From Notes_Wiki

Home > CentOS > CentOS 8.x > System Administration > Filesystem management > Software raid using mdadm > Try to recover failed raid device

Try to recover a removed and reinserted disk issue. The below steps do not work. The issue may not be just with steps but also with hardware. Later it was realized that one of the hard-disks had loose contact and was getting disconnected very often. In any case note that these steps led to complete loss of data on RAID5 system. Perhaps instead of --stop and --create, --assemble should have been used.

  1. First try:
    mdadm --assemble --scan
  2. For active array re-add missing device using:
    mdadm -a /dev/md<n> /dev/sd<x><n>
  3. For inactive array the only option seems to be
    mdadm --detail /dev/md127
    mdadm --stop /dev/md127
    mdadm --create /dev/md127 --level=5 --raid-devices=3 /dev/sda1 /dev/sdb1 /dev/sdc1
    The create instead of recreating array gives warning:
    /dev/sda1 appears to be a part of array
    /dev/sdb1 appears to be a part of array
    /dev/sdc1 appears to be a part of array
    Continue creating array? yes
    This start recovery of the array. Check status using:
    cat /proc/mdstat
    mdadm --detail /dev/md127
    #should show clean, degraded, recovering
    Wait for array to recover before rebooting the machine.
    Refer:
  4. If lvm is used scan and possibly reactive logical volumes:
    lvm lvscan
    lvm lvchange -a y vgname/lvmname


Home > CentOS > CentOS 8.x > System Administration > Filesystem management > Software raid using mdadm > Try to recover failed raid device