xref: /dflybsd-src/contrib/lvm2/dist/udev/11-dm-lvm.rules (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino# Copyright (C) 2009 Red Hat, Inc. All rights reserved.
286d7f5d3SJohn Marino#
386d7f5d3SJohn Marino# This file is part of LVM2.
486d7f5d3SJohn Marino
586d7f5d3SJohn Marino# Udev rules for LVM.
686d7f5d3SJohn Marino#
786d7f5d3SJohn Marino# These rules create symlinks for LVM logical volumes in
886d7f5d3SJohn Marino# /dev/VG directory (VG is an actual VG name). Some udev
986d7f5d3SJohn Marino# environment variables are set (they can be used in later
1086d7f5d3SJohn Marino# rules as well):
1186d7f5d3SJohn Marino#   DM_LV_NAME - logical volume name
1286d7f5d3SJohn Marino#   DM_VG_NAME - volume group name
1386d7f5d3SJohn Marino#   DM_LV_LAYER - logical volume layer (blank if not set)
1486d7f5d3SJohn Marino
1586d7f5d3SJohn Marino# "add" event is processed on coldplug only!
1686d7f5d3SJohn MarinoACTION!="add|change", GOTO="lvm_end"
1786d7f5d3SJohn MarinoENV{DM_UDEV_RULES_VSN}!="?*", GOTO="lvm_end"
1886d7f5d3SJohn MarinoENV{DM_UUID}!="LVM-?*", GOTO="lvm_end"
1986d7f5d3SJohn MarinoENV{DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG}=="1", GOTO="lvm_end"
2086d7f5d3SJohn Marino
2186d7f5d3SJohn Marino# Use DM name and split it up into its VG/LV/layer constituents.
2286d7f5d3SJohn MarinoIMPORT{program}="$env{DM_SBIN_PATH}/dmsetup splitname --nameprefixes --noheadings --rows $env{DM_NAME}"
2386d7f5d3SJohn Marino
2486d7f5d3SJohn Marino# Do not create symlinks for inappropriate subdevices.
2586d7f5d3SJohn MarinoENV{DM_LV_NAME}=="?*_mimage_[0-9]*|pvmove?*|?*_vorigin", GOTO="lvm_disable"
2686d7f5d3SJohn MarinoENV{DM_LV_LAYER}=="?*", GOTO="lvm_disable"
2786d7f5d3SJohn Marino
2886d7f5d3SJohn Marino# Create symlinks for top-level devices only.
2986d7f5d3SJohn MarinoENV{DM_VG_NAME}=="?*", ENV{DM_LV_NAME}=="?*", SYMLINK+="$env{DM_VG_NAME}/$env{DM_LV_NAME}", GOTO="lvm_end"
3086d7f5d3SJohn Marino
3186d7f5d3SJohn MarinoLABEL="lvm_disable"
3286d7f5d3SJohn MarinoENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}="1"
3386d7f5d3SJohn MarinoENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1"
3486d7f5d3SJohn Marino
3586d7f5d3SJohn MarinoLABEL="lvm_end"
36