63-md-raid-arrays.rules 2.1 KB

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