Skip to contentSkip to conversation

mdadm udev rules file just for incremental assembly/disassembly

DISCUSSION Doug Ledford 1 participant 1 message Apr 7, 2010 MD RAID

lore
Share & tools
lore
#0 lore raw

I actually don't keep the rules all in one file in Fedora, I have the udev supplied 64-md-raid.rules file that I don't control and that has the majority of stuff in it, but none of the incremental assembly stuff.
Then I have a separate 65-md-incremental.rules file that is part of the
mdadm package and I therefore have direct control over. That allows me to turn incremental assembly on and off as I see fit without having to bother the udev package maintainer. So, just so you can see how I'm doing things now that works with dracut, that honors whether or not the system is set up to use mdadm or dmraid to handle imsm devices, and see how both incremental assembly and disassembly of devices, and the rule to handle incremental assembly of containers in a post-initramfs environment looks like, here it is.

I should note that this is all tested and working at this point, so on to the next step. Although I will note that I had to turn down sync_speed_max on my imsm arrays or a resync would make the system completely unresponsive until it completed. And I've got at least one bug to that effect open right now. So, I suspect the kernel is not honoring the "only use idle time" part of the resync speed description.

Signature · 6 lines
Doug Ledford <[email protected]>
              GPG KeyID: CFBFF194
	      http://people.redhat.com/dledford

Infiniband specific RPMs available at
	      http://people.redhat.com/dledford/Infiniband

# This file causes block devices with Linux RAID (mdadm) signatures to

# automatically cause mdadm to be run.
# See udev(8) for syntax
SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="linux_raid_member", \
	RUN+="/sbin/mdadm -I $tempnode"
SUBSYSTEM=="block", ACTION=="remove", ENV{ID_FS_TYPE}=="linux_raid_member", \
	RUN+="/sbin/mdadm -If $env{DEVNAME}"

ENV{rd_NO_MDIMSM}=="?*", GOTO="md_imsm_inc_end"
# In case the initramfs only started some of the arrays in our container,

# run incremental assembly on the container itself.  Note: we ran mdadm
# on the container in 64-md-raid.rules, and that's how the MD_LEVEL
# environment variable is already set.  If that disappears from the other
# file, we will need to add this line into the middle of the next rule:
#	IMPORT{program}="/sbin/mdadm -D --export $tempnode", \
SUBSYSTEM=="block", ACTION=="add|change", KERNEL=="md*", \
	ENV{MD_LEVEL}=="container", RUN+="/sbin/mdadm -I $tempnode"
SUBSYSTEM=="block", ACTION=="add", ENV{ID_FS_TYPE}=="isw_raid_member", \
	RUN+="/sbin/mdadm -I $tempnode"
SUBSYSTEM=="block", ACTION=="remove", ENV{ID_FS_TYPE}=="isw_raid_member", \
	RUN+="/sbin/mdadm -If $env{DEVNAME}"

LABEL="md_imsm_inc_end"