1# Copyright (C) 2009 Red Hat, Inc. All rights reserved. 2# 3# This file is part of LVM2. 4 5# Udev rules for device-mapper devices. 6# 7# These rules set permissions for DM devices. 8# 9# This file is considered to be a template where users can put their 10# own entries and then put a copy of it manually to a usual place with 11# user-edited udev rules (usually /etc/udev/rules.d). 12# 13# There are some environment variables set that can be used: 14# DM_UDEV_RULES_VSN - DM udev rules version 15# DM_NAME - actual DM device's name 16# DM_UUID - UUID set for DM device (blank if not specified) 17# DM_SUSPENDED - suspended state of DM device (0 or 1) 18# DM_LV_NAME - logical volume name (not set if LVM device not present) 19# DM_VG_NAME - volume group name (not set if LVM device not present) 20# DM_LV_LAYER - logical volume layer (not set if LVM device not present) 21 22# "add" event is processed on coldplug only! 23ACTION!="add|change", GOTO="dm_end" 24ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="dm_end" 25 26# A few demonstrational examples... 27 28 29# PLAIN DM DEVICES 30# 31# Set permissions for a DM device named 'my_device' exactly 32# ENV{DM_NAME}=="my_device", OWNER:="root", GROUP:="root", MODE:="660" 33 34# Set permissions for all DM devices having 'MY_UUID-' UUID prefix 35# ENV{DM_UUID}=="MY_UUID-?*", OWNER:="root", GROUP:="root", MODE:="660" 36 37 38# LVM DEVICES 39# 40# Set permissions for all LVM devices 41# ENV{DM_UUID}=="LVM-?*", OWNER:="root", GROUP:="root", MODE:="660" 42 43# Set permissions for all devices that belong to one LVM VG 44# ENV{DM_VG_NAME}=="VolGroup00", OWNER:="root", GROUP:="root", MODE:="660" 45 46# Set permissions for an LVM device with VG named VolGroup00 and LV named LogVol00 exactly 47# ENV{DM_VG_NAME}=="VolGroup00", ENV{DM_LV_NAME}=="LogVol00", OWNER:="root", GROUP:="root", MODE:="660" 48 49# Set permissions for all LVM devices that does not belong to a VG named VolGroup00 50# ENV{DM_VG_NAME}!="VolGroup00", OWNER:="root", GROUP:="root", MODE:="660" 51 52 53# ENCRYPTED DEVICES (using cryptsetup >= 1.1) 54# 55# Set permissions for all encrypted devices created by cryptsetup (plain devices) 56# ENV{DM_UUID}=="CRYPT-PLAIN-?*", OWNER:="root", GROUP:="root", MODE:="660" 57 58# Set permissions for all encrypted devices created by cryptsetup (LUKS extension) 59# ENV{DM_UUID}=="CRYPT-LUKS1-?*", OWNER:="root", GROUP:="root", MODE:="660" 60 61# Set permissions for an encrypted device created by cryptsetup and having an exact luks UUID 62# ENV{DM_UUID}=="CRYPT-LUKS1-22fce5c8313c43c68d84b50a3b0fee78-?*", OWNER:="root", GROUP:="root", MODE:="660" 63 64 65# MULTIPATH DEVICES 66# 67# Set permissions for all multipath devices 68# ENV{DM_UUID}=="mpath-?*", OWNER:="root", GROUP:="root", MODE:="660" 69 70# Set permissions for first two partitions created on a multipath device (and detected by kpartx) 71# ENV{DM_UUID}=="part[1-2]-mpath-?*", OWNER:="root", GROUP:="root", MODE:="660" 72 73 74# ...you can use any combination of the comparisons with the environment variables 75# listed at the beginning of this file (udev provides simple pattern matching by 76# using *, ? and [] that you can use, see 'man udev' for more information). 77 78# Set default permissions for all DM devices if not set before. 79# OWNER:="root", GROUP:="root", MODE:="660" 80 81LABEL="dm_end" 82