1 # Copyright (C) 2012 Red Hat, Inc. All rights reserved.
3 # This file is part of LVM2.
7 # Scan all block devices having a PV label for LVM metadata.
8 # Store this information in LVMetaD (the LVM metadata daemon) and maintain LVM
9 # metadata state for improved performance by avoiding further scans while
10 # running subsequent LVM commands or while using lvm2app library.
11 # Also, notify LVMetaD about any relevant block device removal.
13 # This rule is essential for having the information in LVMetaD up-to-date.
14 # It also requires blkid to be called on block devices before so only devices
15 # used as LVM PVs are processed (ID_FS_TYPE="LVM2_member" or "LVM1_member").
17 SUBSYSTEM!="block", GOTO="lvm_end"
19 # Device-mapper devices are processed only on change event or on supported synthesized event.
20 KERNEL=="dm-[0-9]*", ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="lvm_end"
22 # Set proper sbin path, /sbin has higher priority than /usr/sbin.
23 ENV{LVM_SBIN_PATH}="/sbin"
24 TEST!="$env{LVM_SBIN_PATH}/lvm", ENV{LVM_SBIN_PATH}="/usr/sbin"
25 TEST!="$env{LVM_SBIN_PATH}/lvm", GOTO="lvm_end"
27 # Only process devices already marked as a PV - this requires blkid to be called before.
28 ENV{ID_FS_TYPE}=="LVM2_member|LVM1_member", RUN+="$env{LVM_SBIN_PATH}/lvm pvscan --cache --major $major --minor $minor"