Search code examples
filtercommandlvm

Specify lvm filter in command?


I exactly know the usage of filter in lvm.conf (from here), but I want to specify the filters in command, like below:

lvs --filter [ "a/.*/" ]

The lvm just not support that, and I have try the commandprofile but it just not support section devices:

vgs --commandprofile test
Configuration section "devices" is not customizable by a profile.
Ignoring invalid command profile test.
Failed to apply command profile test.

So I want know is there anyway to specify lvm filter in command?


Solution

  • I found the lvm command has the parameter --config, use this parameter can specify the filter in command, like below:

    lvdisplay --config 'devices{filter=["a|^/dev/sdj[0-9]*$|","r|.*|"]}'