filter problem
Hello,
I am evaluating lvm2
I use the following :
LVM2.1.95.10 device-mapper.0.96.04 , kernel 2.4.19
after installing everything I copied the example.conf
to /etc/lvm/lvm.conf
Everything works fine except one thing, the filtering on
devices to scan
the corresponding entry in my lvm.conf is:
filter = ["a/sda/", "r/.*/"]
this is so only the sda devices get scanned as explained in
the man page. But it doesn't work , when I do a "lvm vgscan"
it scans all devices in the /dev directory, not very nice of
lvm to not listen to its filter directives. It is a clean system, no previous lvm was installed, I created one vg , called data with one pv , /dev/sda3 , size 8.68 Gb. I then created a lv , lvol0 size 1700 PE's, and the rest of the PE's (520) I keep to make a snapshot. The lvm partition will be used to store the database of an accountant package, and the remaining PE's wil be used to make snapshots
of the database. Works all perfectly when tested, except for the scan filter. Any hints as what might be the problem?
TIA
Wim Bakker
Wim,
Can you mail me your lvm.conf, and the .cache file from the same directory please ?
- Joe
Quoted 15 lines · Wim Bakker
Hello,
I am evaluating lvm2
I use the following :
LVM2.1.95.10 device-mapper.0.96.04 , kernel 2.4.19 after installing everything I copied the example.conf to/etc/lvm/lvm.conf
Everything works fine except one thing, the filtering on devices to scan
the corresponding entry in my lvm.conf is:
filter = ["a/sda/", "r/.*/"]
this is so only the sda devices get scanned as explained in the man page. But it doesn't work , when I do a "lvm vgscan" it scans all devices in the /dev directory, not very nice of lvm to not listen to its filter directives.
I think there's some confusion about what vgscan will be doing and where the filters fit in. Certainly I just had to look at the code to remind myself:
vgscan will stat *every* device under the /dev tree (or elsewhere if you've specified a different dev dir).
If the device is a block device it will then pass it through the predicate functions/filters in the following order:
i. Regex - is the device accepted by the regexs specified in lvm.conf?
ii. LVM check - is this device a 'recognised' device type. eg, IDE, md, loop etc.
iii. Is it a valid partition number.
iv. Can I successfully open the device
*** This is the expensive operation for non existent devs ***
Personally I see no need for checks ii. and iii. they will probably disappear.
So with your filter which accepts every device containing 'sda' you will find that /dev/ide0 is 'stat'd but no more than this. However with /dev/sda8 (non existent) you will get as far as the open test before being rejected.
Once vgscan has been run the tools will not even stat failed devices.
NOTE: You don't always need to run vgscan on startup with LVM2, only if you know some devices have moved - I just run 'vgchange -ay' in my init script.
- Joe
Quoted 28 lines · Joe Thornber
I think there's some confusion about what vgscan will be doing and where the filters fit in. Certainly I just had to look at the code to remind myself:
vgscan will stat *every* device under the /dev tree (or elsewhere if you've specified a different dev dir).
If the device is a block device it will then pass it through the predicate functions/filters in the following order:
i. Regex - is the device accepted by the regexs specified in lvm.conf?
ii. LVM check - is this device a 'recognised' device type. eg, IDE, md, loop etc.
iii. Is it a valid partition number.
iv. Can I successfully open the device
*** This is the expensive operation for non existent devs ***Personally I see no need for checks ii. and iii. they will probably disappear.
So with your filter which accepts every device containing 'sda' you will find that
/dev/ide0is 'stat'd but no more than this. However with/dev/sda8(non existent) you will get as far as the open test before being rejected.
Quoted 7 lines
Once vgscan has been run the tools will not even stat failed devices.
NOTE: You don't always need to run vgscan on startup with LVM2, only if you know some devices have moved - I just run 'vgchange -ay' in my init script.
- Joe
Thanks for the explanation, it's clear now what's happening.
Wim Bakker