dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/mdadm.rules

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