dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/mdadm.rules

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