diff options
author | Doug Ledford <dledford@redhat.com> | 2010-04-13 22:08:48 -0400 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2010-04-13 22:08:48 -0400 |
commit | d42cd068a62d46aea4e785c93a6fe1fcbb4e7130 (patch) | |
tree | b2a9daa014bd8bd685013143c9e3f5adf3e7bc80 /udev-early-md.rules | |
parent | d1f7ba12a4e1ec9ed3a005a84489073d80be8cc9 (diff) | |
download | mdadm-d42cd068a62d46aea4e785c93a6fe1fcbb4e7130.tar.gz mdadm-d42cd068a62d46aea4e785c93a6fe1fcbb4e7130.tar.xz mdadm-d42cd068a62d46aea4e785c93a6fe1fcbb4e7130.zip |
Sample udev rules file to capture block devices very early in the
udev hot plug sequence, allowing us to make them our own if they
match a proper DOMAIN entry in the mdadm.conf file
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'udev-early-md.rules')
-rw-r--r-- | udev-early-md.rules | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/udev-early-md.rules b/udev-early-md.rules new file mode 100644 index 0000000..176ad61 --- /dev/null +++ b/udev-early-md.rules @@ -0,0 +1,28 @@ +# do not edit this file, it will be overwritten on update + +SUBSYSTEM!="block", GOTO="md_end" +ACTION!="add|change", GOTO="md_end" +# We only care about constituent devices, md arrays are handled in the later +# rules file +KERNEL=="md*", GOTO="md_end" +# If this is already labeled as an md device, we will get it later in the +# incremental rules assembly section +ENV{ID_FS_TYPE}=="isw_raid_member", ENV{rd_NO_MDIMSM}!="?*", GOTO="md_end" +ENV{ID_FS_TYPE}=="linux_raid_member", GOTO="md_end" +# Does this device belong to a path which we are configured to "own"? +# For now, we don't have a good way to differentiate that inside of a +# udev rule, so we are using a really big hammer and just calling mdadm +# in incremental mode with the flag that indicates that mdadm should only +# do something with this device if it determines that it should own it. +# That allows us to program in whatever smarts are needed into mdadm, +# but at the expense of running mdadm on every blk device add|change event :-( +IMPORT{program}="/sbin/mdadm -I --new-device $tempnode" +ENV{MD_OWNED}!="?*", GOTO="md_end" +# We owned the device, so have udev reset the database info in case we +# changed it +IMPORT{program}="/sbin/blkid -o udev -p $tempnode" +OPTIONS+="link_priority=100" +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" + +LABEL="md_end" |