17 Sep 14:33
lvm+dmsetup device mapper rules
From: Michal Soltys <soltys <at> ziu.info>
Subject: lvm+dmsetup device mapper rules
Newsgroups: gmane.linux.hotplug.devel
Date: 2008-09-17 12:35:35 GMT
Subject: lvm+dmsetup device mapper rules
Newsgroups: gmane.linux.hotplug.devel
Date: 2008-09-17 12:35:35 GMT
This is an attempt at generic device mapper rules file. Both lvm and manually (dmsetup) created devices are supported. The rules file depends only on lvm and dmsetup binaries. Standard /dev/disk/* symlinks are created at the end, with additional /dev/disk/by-id/dm-uuid-* symlinks (by device's uuid, not filesystem's one).
KERNEL=="device-mapper", NAME="mapper/control", GOTO="dm_end"
ACTION!="add|change", GOTO="dm_end"
SUBSYSTEM!="block", GOTO="dm_end"
KERNEL!="dm*", GOTO="dm_end"
# First get the name from dmsetup - it can be fed to lvs for parsing
PROGRAM="/sbin/dmsetup info -c --noheadings -o name -j%M -m%m", ENV{DM_NAME}="%c"
ENV{DM_NAME}!="?*", GOTO="dm_end"
ENV{DM_NAME}=="?*", NAME="mapper/$env{DM_NAME}"
# Try to get volume group name
# - lvs always indents first field with 2 spaces (thus %c{2})
# - note, that node doesn't have to exist, and it would fail if $tempnode was used
PROGRAM="/sbin/lvm lvs --ignorelockingfailure --noheadings -o vg_name
/dev/mapper/$env{DM_NAME}", ENV{LVM_VGN}="%c{2}"
ENV{LVM_VGN}!="?*", GOTO="dm_finalize"
PROGRAM="/sbin/lvm lvs --ignorelockingfailure --noheadings -o lv_name
(Continue reading)
RSS Feed