[CentOS] Excluding block device from mdadm scan at boot

Wed Nov 5 08:59:54 UTC 2014
Emmanuel Noobadmin <centos.admin at gmail.com>

Using Centos 6, how to I prevent mdadm from assembling arrays from
specific block devices at boot?

Background:
Due to an accident, one of my servers went down and on reboot, got
stuck first at NFS statd, then at automount after I disable NFS in
single user mode. Only after disabling autofs was the server able to
complete booting into runlevel 3.

On investigation, it seems that mdadm added two new raid devices md126
and md127 assembled into read-only in degraded raid 1 mode from two
unknown device dm-20 and dm-8. My guess is that automount was trying
to mount these devices which caused the boot process to fail.

After doing some googling, I found the lsblk command and was able to
identify dm-20 and dm-8 to be RAID devices created from two lvm
logical volumes. These were added to virtual guests as raid devices
using whole drives instead of partitioned raid.

Unfortunately, I had been unable to find out if it was possible to
tell mdadm not to include these drives, the mdadm.conf manpage doesn't
appear to list any such option. Is there some way to achieve this or
is permanently disabling autofs my only option?