summaryrefslogtreecommitdiffstats
path: root/udev-early-md.rules
blob: e010dab518b49a710c2e5016cdc2071f79d608f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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 -IYg $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"