2009-10-27 01:42:07 +03:00
# Copyright (C) 2009 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
2009-08-03 22:44:54 +04:00
# Udev rules for LVM.
#
# These rules create symlinks for LVM logical volumes in
# /dev/VG directory (VG is an actual VG name). Some udev
# environment variables are set (they can be used in later
# rules as well):
# DM_LV_NAME - logical volume name
# DM_VG_NAME - volume group name
# DM_LV_LAYER - logical volume layer (blank if not set)
2009-10-22 17:11:33 +04:00
# "add" event is processed on coldplug only!
2024-03-07 11:48:49 +03:00
ACTION=="remove", GOTO="lvm_end"
2009-09-11 20:05:20 +04:00
ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="lvm_end"
2009-08-03 22:44:54 +04:00
ENV{DM_UUID}!="LVM-?*", GOTO="lvm_end"
# Use DM name and split it up into its VG/LV/layer constituents.
2012-06-22 13:50:02 +04:00
IMPORT{program}="(DM_EXEC)/dmsetup splitname --nameprefixes --noheadings --rows $env{DM_NAME}"
2009-08-03 22:44:54 +04:00
2013-10-08 15:33:28 +04:00
# DM_SUBSYSTEM_UDEV_FLAG0 is the 'NOSCAN' flag for LVM subsystem.
# This flag is used to temporarily disable selected rules to prevent any
# processing or scanning done on the LVM volume before LVM has any chance
# to zero any stale metadata found within the LV data area. Such stale
# metadata could cause false claim of the LV device, keeping it open etc.
#
2024-03-01 16:45:32 +03:00
# If the NOSCAN flag is present, set DM_UDEV_DISABLE_OTHER_RULES_FLAG
# so those selected rules are surely skipped.
# We don't need to save and restore the previous of DM_UDEV_DISABLE_OTHER_RULES_FLAG,
# that's taken care of in 10-dm.rules.
2024-03-02 01:18:26 +03:00
ENV{DM_SUBSYSTEM_UDEV_FLAG0}=="1", ENV{.DM_NOSCAN}="1", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1"
2013-10-08 15:33:28 +04:00
2010-01-07 23:01:55 +03:00
ENV{DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG}=="1", GOTO="lvm_end"
2024-06-03 13:07:07 +03:00
# Ignore private devices - the ones having any suffix in DM_UUID. Both in udev rules and in systemd.
ENV{DM_UUID}=="LVM-?*-?*", ENV{SYSTEMD_READY}="0", GOTO="lvm_disable"
2009-10-26 17:29:33 +03:00
# Do not create symlinks for inappropriate subdevices.
2010-02-15 19:38:22 +03:00
ENV{DM_LV_NAME}=="pvmove?*|?*_vorigin", GOTO="lvm_disable"
2009-11-01 21:01:31 +03:00
ENV{DM_LV_LAYER}=="?*", GOTO="lvm_disable"
2009-08-03 22:44:54 +04:00
# Create symlinks for top-level devices only.
2009-11-01 21:01:31 +03:00
ENV{DM_VG_NAME}=="?*", ENV{DM_LV_NAME}=="?*", SYMLINK+="$env{DM_VG_NAME}/$env{DM_LV_NAME}", GOTO="lvm_end"
LABEL="lvm_disable"
ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}="1"
ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1"
2010-07-07 15:22:46 +04:00
OPTIONS:="nowatch"
2009-08-03 22:44:54 +04:00
LABEL="lvm_end"