From my dm-devel mail: To recap, the issue is that we want to prevent LVM2/EVMS2 etc from scanning (and using!) the raw physical devices if those are already claimed/used by multipath. LVM2 has a special handling for md_component_detection already; what I want to propose in the following is a bit more general, and I've discussed it with Hannes before. Problem: A general solution for finding out whether another component is using the device we're looking at. Proposed solution: Introduce sub-devices into the sysfs tree. (And, automatically, backlink those to parent devices, but that's just so the tree can be traversed in any order.) For example, /sys/block/sda would have a sub/ directory with "dm-0" in there, pointing at /sys/block/dm-0 (surprise). The /sys/block/dm-0/parent/sd{a,b} entries would do a very surprising thing. This would also allow us to handle partitions in DM better: as all linear mappings on top of /dev/dm-0 would show up in block/dm-0/sub/ and vice versa. md could work the same: block/sys/md0/parent/ would list all the devices (or partitions) which it consists of. This very simple(?) change would make a number of things much easier to figure out. Caveats: - This obviously only works if the devices are already active, not if the specific user is offline; if LVM2 scans before multipath-tools has worked its magic, it won't work. (But then, multipath-tools can figure out that there's already someone else using the raw physical device and not mess with it! Woho, world saved!) - This ONLY exports very rudimentary hierarchical information; it won't tell you what the device is used for or how. However, that information alone would be very helpful already. Greg has voiced no objections to this and it should already work with current sysfs, we just need to export that information.
See also bug #156324 - "dependency tree should be added to libdevmapper".
I believe this has been implemented upstream (2.6.20 or before - looks like it's in FC6 as well, 2.6.19-1.2895.fc6xen) via the 'slaves' directory that contains links back to the /dev/sd* devices. (see below) Feel free to reopen if I'm mistaken or you need something further. # ls /sys/block/dm-29/slaves/ sdaj sdbg # uname -a Linux gfs1.hpperf.rdu.redhat.com 2.6.20 #1 SMP Thu Feb 8 12:06:05 EST 2007 i686 i686 i386 GNU/Linux # ls -l /dev/mapper/mpath427 brw-rw---- 1 root disk 253, 29 Feb 19 13:14 /dev/mapper/mpath427 # ls -l /dev/dm-29 brw-r----- 1 root root 253, 29 Feb 19 13:14 /dev/dm-29 # multipath -ll mpath427 mpath427 (3600805f30005e240db04445cdf0700bd) [size=47 MB][features="1 queue_if_no_path"][hwhandler="1 hp_sw"] \_ round-robin 0 [prio=1][active] \_ 2:0:0:30 sdaj 66:48 [active][ready] \_ round-robin 0 [prio=1][enabled] \_ 3:0:0:30 sdbg 67:160 [active][ghost]