[linux-lvm] confused with lvm2 filter rules

Zdenek Kabelac zkabelac at redhat.com
Wed Jun 5 10:20:50 UTC 2019


Dne 03. 06. 19 v 15:03 Heming Zhao napsal(a):
> Hello,
> 
> I met below filter action when executed 'vgextend'.
> why the filter take no effect on executing pvcreate or vgcreate?

> # rpm -qa | grep lvm2
> lvm2-clvm-2.02.180-8.16.x86_64
> lvm2-cmirrord-2.02.180-8.16.x86_64
> lvm2-2.02.180-8.16.x86_64
> 
> the filter rules:  (you can see all the disk in /dev/disk/by-id/ are
> rejected)
> # grep filter /etc/lvm/lvm.conf | grep -v "#"
>       filter = [ "r|/dev/.*/by-path/.*|", "r|/dev/.*/by-id/.*|",
> "r|/dev/fd.*|", "r|/dev/cdrom|", "a/.*/" ]


Hi

Filter with 'a|.*|' at the end will almost always never work.
As devices do have several names so if you reject it by one name,
you will likely accept it with another name.


So I'd highly recommend only these 2 variants that are 'easy to follow'.


1. White-list devices you want to see and add r|.*|  as the last rule.
^^^^^^^^^^^^^^^ most recommended.

2. Pure list of reject rules (do not add any 'a' rule).

Regards

Zdenek





More information about the linux-lvm mailing list