Blame SOURCES/mdadm.rules

223bf3
# This file causes block devices with Linux RAID (mdadm) signatures to
223bf3
# automatically cause mdadm to be run.
223bf3
# See udev(8) for syntax
223bf3
223bf3
# Don't process any events if anaconda is running as anaconda brings up
223bf3
# raid devices manually
223bf3
ENV{ANACONDA}=="?*", GOTO="md_end"
223bf3
223bf3
# Also don't process disks that are slated to be a multipath device
223bf3
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="md_end"
223bf3
223bf3
# We process add events on block devices (since they are ready as soon as
223bf3
# they are added to the system), but we must process change events as well
223bf3
# on any dm devices (like LUKS partitions or LVM logical volumes) and on
223bf3
# md devices because both of these first get added, then get brought live
223bf3
# and trigger a change event.  The reason we don't process change events
223bf3
# on bare hard disks is because if you stop all arrays on a disk, then
223bf3
# run fdisk on the disk to change the partitions, when fdisk exits it
223bf3
# triggers a change event, and we want to wait until all the fdisks on
223bf3
# all member disks are done before we do anything.  Unfortunately, we have
223bf3
# no way of knowing that, so we just have to let those arrays be brought
223bf3
# up manually after fdisk has been run on all of the disks.
223bf3
223bf3
# First, process all add events (md and dm devices will not really do
223bf3
# anything here, just regular disks, and this also won't get any imsm
223bf3
# array members either)
223bf3
SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="linux_raid_member", \
223bf3
	IMPORT{program}="/sbin/mdadm -I $env{DEVNAME} --export $devnode --offroot $${DEVLINKS}"
223bf3
SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="linux_raid_member", \
223bf3
	ENV{MD_STARTED}=="*unsafe*", ENV{MD_FOREIGN}=="no", ENV{SYSTEMD_WANTS}+="mdadm-last-resort@$env{MD_DEVICE}.timer"
223bf3
SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}=="?*", \
223bf3
	ENV{ID_FS_TYPE}=="linux_raid_member", \
223bf3
	RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
223bf3
SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}!="?*", \
223bf3
	ENV{ID_FS_TYPE}=="linux_raid_member", \
223bf3
	RUN+="/sbin/mdadm -If $name"
223bf3
223bf3
# Next, check to make sure the BIOS raid stuff wasn't turned off via cmdline
223bf3
IMPORT{cmdline}="noiswmd"
223bf3
IMPORT{cmdline}="nodmraid"
223bf3
ENV{noiswmd}=="?*", GOTO="md_imsm_inc_end"
223bf3
ENV{nodmraid}=="?*", GOTO="md_imsm_inc_end"
223bf3
SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="isw_raid_member", \
223bf3
	RUN+="/sbin/mdadm -I $env{DEVNAME}"
fdf7c0
SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="ddf_raid_member", \
fdf7c0
	RUN+="/sbin/mdadm -I $env{DEVNAME}"
223bf3
SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}=="?*", \
223bf3
	ENV{ID_FS_TYPE}=="isw_raid_member", \
223bf3
	RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
223bf3
SUBSYSTEM=="block", ACTION=="remove", ENV{ID_PATH}!="?*", \
223bf3
	ENV{ID_FS_TYPE}=="isw_raid_member", \
223bf3
	RUN+="/sbin/mdadm -If $name"
223bf3
LABEL="md_imsm_inc_end"
223bf3
223bf3
# Next make sure that this isn't a dm device we should skip for some reason
223bf3
ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="dm_change_end"
223bf3
ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="dm_change_end"
223bf3
ENV{DM_SUSPENDED}=="1", GOTO="dm_change_end"
223bf3
KERNEL=="dm-*", SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="linux_raid_member", \
223bf3
	ACTION=="change", RUN+="/sbin/mdadm -I $env{DEVNAME}"
223bf3
LABEL="dm_change_end"
223bf3
223bf3
# Finally catch any nested md raid arrays.  If we brought up an md raid
223bf3
# array that's part of another md raid array, it won't be ready to be used
223bf3
# until the change event that occurs when it becomes live
223bf3
KERNEL=="md*", SUBSYSTEM=="block", ENV{ID_FS_TYPE}=="linux_raid_member", \
223bf3
	ACTION=="change", RUN+="/sbin/mdadm -I $env{DEVNAME}"
223bf3
223bf3
LABEL="md_end"