[linux-lvm] Identifying useable block devices
prajnoha at redhat.com
Thu Jan 16 06:04:44 UTC 2014
On 01/15/2014 09:19 AM, Marius Vollmer wrote:
> # ls /dev/mapper/TEST-*
> /dev/mapper/TEST-pool /dev/mapper/TEST-pool_tmeta /dev/mapper/TEST-thin
> /dev/mapper/TEST-pool_tdata /dev/mapper/TEST-pool-tpool
> How can a program tell that only /dev/mapper/TEST-thin can really be
> used as a block device, and the rest should be ignored?
> Is there a way to do this by looking at "udevadm info", for example?
> (What seems to work is skipping all nodes that have
> DM_UDEV_IGNORE_DISK_RULES_FLAG set to true. Is this maybe even
> documented somewhere?)
Those flags were primarily targeted to direct udev processing.
But it could be used as DM_UDEV_DISABLE_DISK_RULES_FLAG should
be always set for internal devices...
This flag actually means that udev should skip scanning the device
for metadata and it should skip creating any symlinks in /dev/disk
directory - which is a directory with symlink names based on metadata
found (e.g. filesystem uuid, subsystem names etc.).
However, for your purpose, I'd better use DM_UDEV_DISABLE_OTHER_RULES_FLAG
which just tells that everything else other than DM/LVM related should
skip this device.
For now, these flags are only documented directly in libdevmapper.h
(as they were only meant to direct udev rules and these situations
were all audited directly by communicating with other teams).
I could probably add a few lines to the man page directly though as
others could use this even when reading udev database...
Anyway, the most important rule for avoiding internal devices and
using the right ones is to follow /dev/<vgname>/<lvname> existence,
as already said in this thread.
More information about the linux-lvm