[linux-lvm] Option devices/dir different from /dev does not work

Zdenek Kabelac zkabelac at redhat.com
Mon Jan 28 10:01:57 UTC 2019

Dne 26. 01. 19 v 22:14 Andrei Borzenkov napsal(a):
> I attempt to put device nodes for volumes in sub-directory of /dev to
> avoid accidental conflict between device name and volume group and
> general /dev pollution. VxVM always did it, using /dev/vx as base
> directory, so I would use something like /dev/lvm.

That is a very HARD task you want to achieve - I'd probably better advice you 
to avoid doing this.

First - please start out with reasoning.

Normally it really DOES NOT matter where device node is - it's in /dev and you 
can create as my subdirs there - it will not help anything - as any app can 
still find the node be there.

You CANNOT change where /dev/dm-XXX node will appear - it's made by kernel 
just one any DM device is created. Udev ONLY controls it's symlink.

With LVM - we advice users to use  /dev/vg/lv  links - although you will find 
out there are way more of them in your /dev  pointing to final /dev/dm node - 
so you SHOULD be using these symlinks for passing devices to VxVM.

If all your work is because you want to avoid LVM commands to access device
you've created and passed to your VMs - you have number of way  easier 
solutions - personally I'd recommend to use FILTERS (in lvm.conf). Just 
'accept' devices which are possible PVs for your hosting machine (be it 
/dev/sd* or whatever else you have) and reject any other device from scanning 
- this will greatly improve performance, avoids various scanning troubles and 
also makes your VMs completely separated.

In the upstream (unstable git HEAD) we have something named 'scan_lvs' in 
lvm.conf  - where you can globally disable scanning of any activated LV  (DM 
device with LVM- UUID prefix) - but it's also not a perfect solution in case 
you would need to use same actived devices locally and some others not.



More information about the linux-lvm mailing list