dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/mdadm.rules

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