8640094c78ac581b3d8481dcf95f4fbb8c2d8588
[multipath-tools/.git] / kpartx / kpartx.rules
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
7 KERNEL!="dm-*", GOTO="kpartx_end"
8 ACTION=="remove", GOTO="kpartx_end"
9
10 ENV{DM_TABLE_STATE}!="LIVE", GOTO="kpartx_end"
11 ENV{DM_ACTION}=="PATH_FAILED|PATH_REINSTATED", GOTO="kpartx_end"
12 ENV{DM_DEPS}=="0", GOTO="kpartx_end"
13
14 ENV{DM_UUID}=="?*", IMPORT{program}=="kpartx_id %M %m $env{DM_UUID}"
15
16 OPTIONS="link_priority=50"
17
18 # Create persistent links for multipath tables
19 ENV{DM_UUID}=="mpath-*", \
20         SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}"
21 ENV{DM_MPATH}=="?*", ENV{DM_PART}!="?*", \
22         SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_MPATH}"
23
24 # Create persistent links for partitions
25 ENV{DM_PART}=="?*", \
26         SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}-part$env{DM_PART}"
27 ENV{DM_MPATH}=="?*", ENV{DM_PART}=="?*", \
28         SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_MPATH}-part$env{DM_PART}"
29
30 # Create dm tables for partitions
31 ENV{DM_STATE}!="SUSPENDED", ENV{DM_UUID}=="mpath-*", \
32         RUN+="/sbin/kpartx -u -p -part /dev/$name"
33
34 LABEL="kpartx_end"
35
36