dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/mdadm.rules

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