]> git.ipfire.org Git - thirdparty/mdadm.git/blob - udev-md-raid.rules
Assemble(): don't dup_super() before we need it.
[thirdparty/mdadm.git] / udev-md-raid.rules
1 # do not edit this file, it will be overwritten on update
2
3 SUBSYSTEM!="block", GOTO="md_end"
4
5 # handle potential components of arrays (the ones supported by md)
6 ENV{ID_FS_TYPE}=="ddf_raid_member|isw_raid_member|linux_raid_member", GOTO="md_inc"
7 GOTO="md_inc_skip"
8
9 LABEL="md_inc"
10
11 # remember you can limit what gets auto/incrementally assembled by
12 # mdadm.conf(5)'s 'AUTO' and selectively whitelist using 'ARRAY'
13 ACTION=="add", RUN+="/sbin/mdadm --incremental $tempnode"
14 ACTION=="remove", ENV{ID_PATH}=="?*", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
15 ACTION=="remove", ENV{ID_PATH}!="?*", RUN+="/sbin/mdadm -If $name"
16
17 LABEL="md_inc_skip"
18
19 # handle md arrays
20 ACTION!="add|change", GOTO="md_end"
21 KERNEL!="md*", GOTO="md_end"
22
23 # partitions have no md/{array_state,metadata_version}, but should not
24 # for that reason be ignored.
25 ENV{DEVTYPE}=="partition", GOTO="md_ignore_state"
26
27 # container devices have a metadata version of e.g. 'external:ddf' and
28 # never leave state 'inactive'
29 ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
30 TEST!="md/array_state", GOTO="md_end"
31 ATTR{md/array_state}=="|clear|inactive", GOTO="md_end"
32 LABEL="md_ignore_state"
33
34 IMPORT{program}="/sbin/mdadm --detail --export $tempnode"
35 ENV{DEVTYPE}=="disk", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}", OPTIONS+="string_escape=replace"
36 ENV{DEVTYPE}=="disk", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}"
37 ENV{DEVTYPE}=="disk", ENV{MD_DEVNAME}=="?*", SYMLINK+="md/$env{MD_DEVNAME}"
38 ENV{DEVTYPE}=="partition", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}-part%n", OPTIONS+="string_escape=replace"
39 ENV{DEVTYPE}=="partition", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}-part%n"
40 ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[^0-9]", SYMLINK+="md/$env{MD_DEVNAME}%n"
41 ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[0-9]", SYMLINK+="md/$env{MD_DEVNAME}p%n"
42
43 IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
44 OPTIONS+="link_priority=100"
45 OPTIONS+="watch"
46 ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
47 ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
48
49 LABEL="md_end"