Samuel Mendoza-Jonas | c775f29 | 2015-09-14 13:10:27 +1000 | [diff] [blame] | 1 | # do not edit this file, it will be overwritten on update |
| 2 | |
| 3 | SUBSYSTEM!="block", GOTO="md_end" |
| 4 | |
| 5 | # handle md arrays |
| 6 | ACTION!="add|change", GOTO="md_end" |
| 7 | KERNEL!="md*", GOTO="md_end" |
| 8 | |
| 9 | # partitions have no md/{array_state,metadata_version}, but should not |
| 10 | # for that reason be ignored. |
| 11 | ENV{DEVTYPE}=="partition", GOTO="md_ignore_state" |
| 12 | |
| 13 | # container devices have a metadata version of e.g. 'external:ddf' and |
| 14 | # never leave state 'inactive' |
| 15 | ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state" |
| 16 | TEST!="md/array_state", ENV{SYSTEMD_READY}="0", GOTO="md_end" |
| 17 | ATTR{md/array_state}=="|clear|inactive", ENV{SYSTEMD_READY}="0", GOTO="md_end" |
| 18 | LABEL="md_ignore_state" |
| 19 | |
| 20 | IMPORT{program}="/usr/sbin/mdadm --detail --export $devnode" |
| 21 | ENV{DEVTYPE}=="disk", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}", OPTIONS+="string_escape=replace" |
| 22 | ENV{DEVTYPE}=="disk", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}" |
| 23 | ENV{DEVTYPE}=="disk", ENV{MD_DEVNAME}=="?*", SYMLINK+="md/$env{MD_DEVNAME}" |
| 24 | ENV{DEVTYPE}=="partition", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}-part%n", OPTIONS+="string_escape=replace" |
| 25 | ENV{DEVTYPE}=="partition", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}-part%n" |
| 26 | ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[^0-9]", SYMLINK+="md/$env{MD_DEVNAME}%n" |
| 27 | ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[0-9]", SYMLINK+="md/$env{MD_DEVNAME}p%n" |
| 28 | |
| 29 | IMPORT{builtin}="blkid" |
| 30 | OPTIONS+="link_priority=100" |
| 31 | OPTIONS+="watch" |
| 32 | ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" |
| 33 | ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" |
| 34 | |
| 35 | ENV{MD_LEVEL}=="raid[1-9]*", ENV{SYSTEMD_WANTS}+="mdmonitor.service" |
| 36 | |
| 37 | # Tell systemd to run mdmon for our container, if we need it. |
| 38 | ENV{MD_LEVEL}=="raid[1-9]*", ENV{MD_CONTAINER}=="?*", PROGRAM="/usr/bin/readlink $env{MD_CONTAINER}", ENV{MD_MON_THIS}="%c" |
| 39 | ENV{MD_MON_THIS}=="?*", PROGRAM="/usr/bin/basename $env{MD_MON_THIS}", ENV{SYSTEMD_WANTS}+="mdmon@%c.service" |
| 40 | |
| 41 | LABEL="md_end" |