]> git.ipfire.org Git - thirdparty/mdadm.git/blame - udev-md-raid.rules
Create: support --readonly flag.
[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
e5e54ff1
MS
5# handle potential components of arrays (the ones supported by md)
6ENV{ID_FS_TYPE}=="ddf_raid_member|isw_raid_member|linux_raid_member", GOTO="md_inc"
7GOTO="md_inc_skip"
8
9LABEL="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'
13ACTION=="add", RUN+="/sbin/mdadm --incremental $tempnode"
14ACTION=="remove", ENV{ID_PATH}=="?*", RUN+="/sbin/mdadm -If $name --path $env{ID_PATH}"
15ACTION=="remove", ENV{ID_PATH}!="?*", RUN+="/sbin/mdadm -If $name"
16
17LABEL="md_inc_skip"
7efa6bc3
N
18
19# handle md arrays
20ACTION!="add|change", GOTO="md_end"
757a5d74
N
21KERNEL!="md*", GOTO="md_end"
22
fa509028
N
23# partitions have no md/{array_state,metadata_version}, but should not
24# for that reason be ignored.
25ENV{DEVTYPE}=="partition", GOTO="md_ignore_state"
26
757a5d74
N
27# container devices have a metadata version of e.g. 'external:ddf' and
28# never leave state 'inactive'
29ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
fabf4941 30TEST!="md/array_state", GOTO="md_end"
339b7746 31ATTR{md/array_state}=="|clear|inactive", ENV{SYSTEMD_READY}="0", GOTO="md_end"
757a5d74
N
32LABEL="md_ignore_state"
33
34IMPORT{program}="/sbin/mdadm --detail --export $tempnode"
67732c39 35ENV{DEVTYPE}=="disk", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}", OPTIONS+="string_escape=replace"
757a5d74
N
36ENV{DEVTYPE}=="disk", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}"
37ENV{DEVTYPE}=="disk", ENV{MD_DEVNAME}=="?*", SYMLINK+="md/$env{MD_DEVNAME}"
67732c39 38ENV{DEVTYPE}=="partition", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}-part%n", OPTIONS+="string_escape=replace"
757a5d74
N
39ENV{DEVTYPE}=="partition", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}-part%n"
40ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[^0-9]", SYMLINK+="md/$env{MD_DEVNAME}%n"
41ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[0-9]", SYMLINK+="md/$env{MD_DEVNAME}p%n"
42
5bac0443 43IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
757a5d74 44OPTIONS+="link_priority=100"
2913d9df 45OPTIONS+="watch"
757a5d74
N
46ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
47ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
48
49LABEL="md_end"