Discussion:
[linux-lvm] LVM filter ignored?
k***@knebb.de
2016-12-29 20:28:04 UTC
Permalink
Hi all,

I am using LVM for several years but now I face an issue where I have no
clue how to deal with.

I want to have a VG on top of a drbd device (Distributed Replicated
Block Device) which should not be an issue according to docs:
https://www.drbd.org/en/doc/users-guide-83/s-lvm-drbd-as-pv

Unfortunately I am always getting "duplicate device" errors as LVM
recons a pv on /dev/sdb (underlying device for drbd) as well as on
/dev/drbd0

Now I tried to configure filters to match my setup. But it seems I do
not understand the filter rules.

I need to enable /dev/sda incl. all partitions. (for root)
I need to disable /dev/sdb at all as it is the device for drbd!
I need to enable /dev/drbd0 as the "real" PV.
I can disable all others.

So I tried:
filter = [ "r|sdb.*/|","a|drbd0/|","a|.*/|" ]

Which results in the duplicate-issue:
[***@backuppc ~]# pvcreate /dev/drbd0
Physical volume "/dev/drbd0" successfully created.
[***@backuppc ~]# pvscan --cache
WARNING: PV eEpd0B-VaET-V2mH-9InB-pYab-P5Bp-hjfOhh on /dev/sdb was
already found on /dev/drbd0.
WARNING: Disabling lvmetad cache which does not support duplicate PVs.
WARNING: Not using lvmetad because duplicate PVs were found.


So anyone having an idea what is wrong with my filter config? As the
docs are very unclear about the exact syntax I did as well some other
versions but no one leads to the resul I want to have...

So what are correct filter rules?

Greetings

/christian
Zdenek Kabelac
2017-01-02 15:06:05 UTC
Permalink
Post by k***@knebb.de
Hi all,
I am using LVM for several years but now I face an issue where I have no clue
how to deal with.
I want to have a VG on top of a drbd device (Distributed Replicated Block
https://www.drbd.org/en/doc/users-guide-83/s-lvm-drbd-as-pv
Unfortunately I am always getting "duplicate device" errors as LVM recons a pv
on /dev/sdb (underlying device for drbd) as well as on /dev/drbd0
Now I tried to configure filters to match my setup. But it seems I do not
understand the filter rules.
I need to enable /dev/sda incl. all partitions. (for root)
I need to disable /dev/sdb at all as it is the device for drbd!
I need to enable /dev/drbd0 as the "real" PV.
I can disable all others.
filter = [ "r|sdb.*/|","a|drbd0/|","a|.*/|" ]
Hi

Just check the 'comment' for filters in lvm.conf -
there is stated you should NOT mix 'r' & 'a' together
(there is even no need for this in 99.9999%)

So please focus on keeping things simple:

- either use plain list of rejects 'r'
- or set 'white-list' with all 'a' finished with 'r .*'

Every other usage does require quite good understanding how
the devices are scanned and how many accessible paths for them
exists in today's /dev directory.

To to be exact in your case:

Use just: [ "r|/dev/sdb|" ]

OR (if you want to use just drdb0) :

[ "a|drbd0/|", "r|.*/|" ]

(eventually add more 'a' with more PV devices you have)


Regards

Zdenek
k***@knebb.de
2017-01-02 19:20:54 UTC
Permalink
Hi,
Post by Zdenek Kabelac
Post by k***@knebb.de
filter = [ "r|sdb.*/|","a|drbd0/|","a|.*/|" ]
Just check the 'comment' for filters in lvm.conf -
there is stated you should NOT mix 'r' & 'a' together
(there is even no need for this in 99.9999%)
Well....it writes "be careful mixing" but in the examples mixing is
shown. Appeared not to be soooo important.
Post by Zdenek Kabelac
- either use plain list of rejects 'r'
- or set 'white-list' with all 'a' finished with 'r .*'
Use just: [ "r|/dev/sdb|" ]
I set this not as you recommended and indeed it appears to be working,
Thanks, even I do not have a clue what I did wrong as I remember I had
it this way. But I moght be wrong as it did not work as I configured it.

Thanks a lot, looks great now!

/CHRISTIAN
Zdenek Kabelac
2017-01-02 20:18:46 UTC
Permalink
Post by k***@knebb.de
Hi,
Post by Zdenek Kabelac
Post by k***@knebb.de
filter = [ "r|sdb.*/|","a|drbd0/|","a|.*/|" ]
Just check the 'comment' for filters in lvm.conf -
there is stated you should NOT mix 'r' & 'a' together
(there is even no need for this in 99.9999%)
Well....it writes "be careful mixing" but in the examples mixing is
shown. Appeared not to be soooo important.
Yep looking at the example it's actually bad one ;) will be fixed.
Post by k***@knebb.de
Post by Zdenek Kabelac
- either use plain list of rejects 'r'
- or set 'white-list' with all 'a' finished with 'r .*'
Use just: [ "r|/dev/sdb|" ]
I set this not as you recommended and indeed it appears to be working,
When you reject a device - and then you accept everything - device will
be accepted via 'different' link/mknod whatever it finds...
And there are now many links to reference the same device.

When you just reject sdb - you will reject all it's symlink (implicit)
But when you then in the same filter row later 'accept' sdb as some
'/dev/disk-by...' you explicitly overrule this 'implicit' reject.

By default what is NOT reject is 'accepted' by default in sence 'it's been
not rejected' by any previous filter.

It's almost similar to having explicit 'a|.*|' at the end, but will not accept
rejected 'implicit' symlinks ;)

OK - enough - I'm pretty sure noone can actually understand this :)

Clear message is - use either WHITE-LIST, or plain REJECT LIST
follow this rule and you have always clear logic.

That's basically all you need ;)
Post by k***@knebb.de
Thanks, even I do not have a clue what I did wrong as I remember I had
it this way. But I moght be wrong as it did not work as I configured it.
As said - it's hard to explain :)
And no - I've not been designing this logic...

Regards

Zdenek

Loading...