Description of problem: We are using lvm2 to manage storage that is reached via device-mapper-multipath. In an attempt to make the lvm commands show names of multipath devices rather than relatively meaningless /dev/dm-[0-9]* names, we have put a filter in our /etc/lvm/lvm.conf: filter = [ "r|/dev/dm-.*|","a/.*/" ] However this only works the in the absence of a /etc/lvm/.cache file. Version-Release number of selected component (if applicable): lvm2-2.02.01-1.3.RHEL4 How reproducible: Completely. Steps to Reproduce: 1. Create some devicemapper devices to be managed by LVM 2. Make (some of) those devices LVM manageable, e.g. 'pvcreate ....' 3. Insert a filter into /etc/lvm/lvm.conf (see above) 3. Remove the lvm cache: rm /etc/lvm/.cache 4. Run /usr/sbin/pvs. Observe names such as /dev/mapper/... in the output 5. Run /usr/sbin/pvs again. Note that /dev/mapper/... has been replaced by /dev/dm-[0-9]* Actual results: # rm /etc/lvm/.cache rm: remove regular file `/etc/lvm/.cache'? y # /usr/sbin/pvs PV VG Fmt Attr PSize PFree /dev/cciss/c0d0p5 Volume00 lvm2 a- 63.72G 49.72G /dev/mapper/redolog0 oraredo lvm2 a- 4.00G 0 /dev/mapper/sandisk0 srevg lvm2 a- 10.00G 0 /dev/mapper/sandisk1 srevg lvm2 a- 10.00G 0 /dev/mapper/sandisk2 srevg lvm2 a- 10.00G 0 /dev/mapper/sandisk3 srevg lvm2 a- 10.00G 0 /dev/mapper/sandisk4 srevg lvm2 a- 10.00G 0 /dev/mapper/sandisk5 srevg lvm2 a- 10.00G 0 /dev/mapper/sandisk6 srevg lvm2 a- 10.00G 4.96G /dev/mapper/sandisk7 srevg lvm2 a- 10.00G 0 /dev/mapper/sandisk8 srevg lvm2 a- 10.00G 0 /dev/mapper/sandisk9 srevg lvm2 a- 10.00G 0 # /usr/sbin/pvs PV VG Fmt Attr PSize PFree /dev/cciss/c0d0p5 Volume00 lvm2 a- 63.72G 49.72G /dev/dm-0 srevg lvm2 a- 10.00G 0 /dev/dm-1 srevg lvm2 a- 10.00G 0 /dev/dm-10 oraredo lvm2 a- 4.00G 0 /dev/dm-2 srevg lvm2 a- 10.00G 0 /dev/dm-3 srevg lvm2 a- 10.00G 0 /dev/dm-4 srevg lvm2 a- 10.00G 0 /dev/dm-5 srevg lvm2 a- 10.00G 0 /dev/dm-6 srevg lvm2 a- 10.00G 0 /dev/dm-7 srevg lvm2 a- 10.00G 4.96G /dev/dm-8 srevg lvm2 a- 10.00G 0 /dev/dm-9 srevg lvm2 a- 10.00G 0 Expected results: The output of /usr/sbin/pvs (and other lvm commands) should not be affected by presence of the cache file, and in any case should respect filters in /etc/lvm/lvm.conf. We expect to see LVM output in terms of /dev/mapper names all the time - no /dev/dm-* names. Additional info: We have tried various filter regexps. Have we got it right? There are other paths to the devicemapper devices (e.g. /dev/mpath/*) -- are these interfering?
As things stand, filters control which underlying devices (i.e. major/minor numbers) are accessed by the software. They do not control device naming. It would be nice to change this.
Thanks for the quick reply. So the filtering mechanism isn't intended to do what we want, right now? It seems odd to go to all the trouble of filtering a set of names when looking for major/minor numbers, only to subsequently allow the use of those names as 'friendly' names for those same numbers. I agree it would be nice to change that :-) By the way, I *can* get the effect I want by filtering the cache file, i.e. running 'grep -v dm-' over it. Do you have a problem with that as a workaround?
In response to comment#1, why would it be nice to have LVM handle renaming devices? Shouldn't that be left to udev et al?
Doesn't preferred_names achive this?
In reply to comment #3 this isn't talking about actual renaming, rather it's how LVM2 chooses which name to report for a device when there exist multiple device nodes/symlinks that all reference the same major/minor number.
You can now set devices/preferred_names in lvm.conf as Bryn points out: # If several entries in the scanned directories correspond to the # same block device and the tools need to display a name for device, # all the pathnames are matched against each item in the following # list of regular expressions in turn and the first match is used. preferred_names = [ ]