[udev] rules files for event proxying and kpartx split
[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
12 ENV{DM_UUID}=="?*", IMPORT{program}=="/sbin/kpartx_id %M %m $env{DM_UUID}"
13
14 OPTIONS="link_priority=50"
15
16 # Create persistent links for multipath tables
17 ENV{DM_UUID}=="mpath-*", \
18         SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}"
19
20 # Create persistent links for dmraid tables
21 ENV{DM_UUID}=="mpath-*", \
22         SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}"
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
28 # Create dm tables for partitions
29 ENV{DM_STATE}=="ACTIVE", ENV{DM_UUID}=="mpath-*", \
30         RUN+="/sbin/kpartx -a -p -part /dev/$kernel"
31 ENV{DM_STATE}=="ACTIVE", ENV{DM_UUID}=="dmraid-*", \
32         RUN+="/sbin/kpartx -a -p -part /dev/$kernel"
33
34 LABEL="kpartx_end"
35
36