]> git.ipfire.org Git - thirdparty/mdadm.git/blame - udev-md-raid.rules
FIX: Prevent using null list pointer
[thirdparty/mdadm.git] / udev-md-raid.rules
CommitLineData
757a5d74
N
1# do not edit this file, it will be overwritten on update
2
3SUBSYSTEM!="block", GOTO="md_end"
757a5d74 4
7efa6bc3 5# handle potential components of arrays
3b1dab1b
N
6ENV{ID_FS_TYPE}=="linux_raid_member", ENV{ID_PATH}!="", ACTION=="remove", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
7ENV{ID_FS_TYPE}=="linux_raid_member", ENV{ID_PATH}=="", ACTION=="remove", RUN+="/sbin/mdadm -If $name"
7efa6bc3 8ENV{ID_FS_TYPE}=="linux_raid_member", ACTION=="add", RUN+="/sbin/mdadm --incremental $env{DEVNAME}"
3b1dab1b
N
9ENV{ID_FS_TYPE}=="isw_raid_member", ENV{ID_PATH}!="", ACTION=="remove", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
10ENV{ID_FS_TYPE}=="isw_raid_member", ENV{ID_PATH}=="", ACTION=="remove", RUN+="/sbin/mdadm -If $name"
475a01b8 11ENV{ID_FS_TYPE}=="isw_raid_member", ACTION=="add", RUN+="/sbin/mdadm --incremental $env{DEVNAME}"
7efa6bc3
N
12
13# handle md arrays
14ACTION!="add|change", GOTO="md_end"
757a5d74
N
15KERNEL!="md*", GOTO="md_end"
16
fa509028
N
17# partitions have no md/{array_state,metadata_version}, but should not
18# for that reason be ignored.
19ENV{DEVTYPE}=="partition", GOTO="md_ignore_state"
20
757a5d74
N
21# container devices have a metadata version of e.g. 'external:ddf' and
22# never leave state 'inactive'
23ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
fabf4941 24TEST!="md/array_state", GOTO="md_end"
757a5d74
N
25ATTR{md/array_state}=="|clear|inactive", GOTO="md_end"
26LABEL="md_ignore_state"
27
28IMPORT{program}="/sbin/mdadm --detail --export $tempnode"
67732c39 29ENV{DEVTYPE}=="disk", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}", OPTIONS+="string_escape=replace"
757a5d74
N
30ENV{DEVTYPE}=="disk", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}"
31ENV{DEVTYPE}=="disk", ENV{MD_DEVNAME}=="?*", SYMLINK+="md/$env{MD_DEVNAME}"
67732c39 32ENV{DEVTYPE}=="partition", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}-part%n", OPTIONS+="string_escape=replace"
757a5d74
N
33ENV{DEVTYPE}=="partition", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}-part%n"
34ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[^0-9]", SYMLINK+="md/$env{MD_DEVNAME}%n"
35ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[0-9]", SYMLINK+="md/$env{MD_DEVNAME}p%n"
36
5bac0443 37IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
757a5d74 38OPTIONS+="link_priority=100"
2913d9df 39OPTIONS+="watch"
757a5d74
N
40ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
41ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
42
43LABEL="md_end"