SUBSYSTEM!="block", GOTO="device_mapper_end" KERNEL!="dm-*", GOTO="device_mapper_end" ACTION!="add|change", GOTO="device_mapper_end" IMPORT{program}="/sbin/dmsetup export -j%M -m%m" ENV{DM_NAME}!="?*", GOTO="device_mapper_end" ENV{DM_NAME}=="temporary-cryptsetup-*", OPTIONS="ignore_device" # Make the device take the /dev/mapper name OPTIONS+="string_escape=none", NAME="mapper/$env{DM_NAME}" SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}" ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}" # Add a symlink for LVM devices ENV{DM_UUID}=="LVM-*", PROGRAM="/bin/sh -c 'set `/sbin/lvm lvdisplay -C -o vg_name,lv_name --noheadings /dev/$name` ; echo $1/$2'", SYMLINK+="$result" ENV{DM_STATE}=="SUSPENDED", GOTO="device_mapper_end" ENV{DM_TARGET_TYPES}=="|*error*", GOTO="device_mapper_end" # by-uuid and by-label symlinks IMPORT{program}="/sbin/blkid -o udev -p $tempnode" OPTIONS+="link_priority=-100" OPTIONS+="watch" ENV{DM_UUID}=="DMRAID-*", OPTIONS="link_priority=100" ENV{DM_TARGET_TYPES}=="*snapshot-origin*", OPTIONS+="link_priority=-90" ENV{ID_FS_UUID_ENC}=="?*", ENV{ID_FS_USAGE}=="filesystem|other|crypto", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" ENV{ID_FS_LABEL_ENC}=="?*", ENV{ID_FS_USAGE}=="filesystem|other", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" LABEL="device_mapper_end"