[linux-lvm] Identifying useable block devices

Marius Vollmer marius.vollmer at redhat.com
Wed Jan 15 08:19:33 UTC 2014


Hi,

when looking at the udev properties of a device mapper node, how can I
decide whether this is a block device that the user can use for creating
filesystems on, etc?

For example, when creating a thinly provisioned logical volume with these
steps

 # vgcreate TEST /dev/loop1
 # lvcreate TEST --thinpool pool -L 80
 # lvcreate -T TEST/pool -n thin -V 100

I end up with a lot of devices:

 # 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?)

Thanks!




More information about the linux-lvm mailing list