95-kpartx.rules 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #
  2. # persistent links for device-mapper devices
  3. # only hardware-backed device-mapper devices (ie multipath, dmraid,
  4. # and kpartx) have meaningful persistent device names
  5. #
  6. KERNEL!="dm-*", GOTO="kpartx_end"
  7. ACTION!="add|change", GOTO="kpartx_end"
  8. ENV{DM_UUID}!="?*", GOTO="kpartx_end"
  9. # This is a temporary hack until Debian's dmsetup properly supports "dmsetup
  10. # export". For more information see: #434241, #487881, #493078
  11. IMPORT{program}="dmsetup_env %M %m"
  12. # Create dm tables for partitions on multipath devices.
  13. ENV{DM_UUID}!="mpath-?*", GOTO="mpath_kpartx_end"
  14. # DM_SUBSYSTEM_UDEV_FLAG1 is the "skip_kpartx" flag.
  15. # For events not generated by libdevmapper, we need to fetch it from db.
  16. ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}!="1", IMPORT{db}="DM_SUBSYSTEM_UDEV_FLAG1"
  17. ENV{DM_SUBSYSTEM_UDEV_FLAG1}=="1", GOTO="mpath_kpartx_end"
  18. # 11-dm-mpath.rules sets MPATH_UNCHANGED for events that can be ignored.
  19. ENV{MPATH_UNCHANGED}=="1", GOTO="mpath_kpartx_end"
  20. # Don't run kpartx now if we know it will fail or hang.
  21. ENV{DM_SUSPENDED}=="1", GOTO="mpath_kpartx_end"
  22. ENV{DM_NOSCAN}=="1", GOTO="mpath_kpartx_end"
  23. # Run kpartx
  24. GOTO="run_kpartx"
  25. LABEL="mpath_kpartx_end"
  26. ## Code for other subsystems (non-multipath) could be placed here ##
  27. GOTO="kpartx_end"
  28. LABEL="run_kpartx"
  29. RUN+="/sbin/kpartx -un -p -part /dev/$name"
  30. LABEL="kpartx_end"