From: Michal Soltys <soltys@ziu.info>
To: linux-hotplug@vger.kernel.org
Subject: lvm+dmsetup device mapper rules
Date: Wed, 17 Sep 2008 12:35:35 +0000 [thread overview]
Message-ID: <48D0F997.4030601@ziu.info> (raw)
[-- Attachment #1: Type: text/plain, Size: 325 bytes --]
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).
[-- Attachment #2: 63-device-mapper.rules --]
[-- Type: text/plain, Size: 1364 bytes --]
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 /dev/mapper/$env{DM_NAME}", ENV{LVM_LVN}="%c{2}"
ENV{LVM_LVN}!="?*", GOTO="dm_finalize"
SYMLINK+="$env{LVM_VGN}/$env{LVM_LVN}"
LABEL="dm_finalize"
# /disk/* symlinks
PROGRAM="/sbin/dmsetup info -c --noheadings -o uuid -j%M -m%m", SYMLINK+="disk/by-id/dm-uuid-%c"
IMPORT{program}="vol_id --export $tempnode"
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
LABEL="dm_end"
reply other threads:[~2008-09-17 12:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48D0F997.4030601@ziu.info \
--to=soltys@ziu.info \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).