Sunday, November 8, 2020

Duplicate PV in Linux

As stated in one of my previous post, I have lost password for word press blog.  So, I decided to repost articles from wordpress  to  Blogger.   

In the first of the articles that I am reposting, this is on Linux LVM.

Often we have seen people coming up with duplicate PV issues in lvm.  Wondered what this exactly means ?

This message is related to LVM filter.  Now comes the question what is LVM filter?   

LVM filter can be considered as a pattern of devices that can be searched as a part of the LVM scan.  From the Man Page "Patterns are regular expressions delimited by any character and preceded by a (for accept) or r (for reject). The list is traversed in order, and the first regex that matches determines if the device will be accepted or rejected (ignored). Devices that don't match any patterns are accepted"

- When using device-mapper-multipath or other multipath software such as EMC PowerPath or Hitachi Dynamic Link Manager (HDLM), each path to a particular logical unit number (LUN) is registered as a different SCSI device, such as /dev/sdb, /dev/sdc, and so on. 

- The multipath software will then create a new device that maps to those individual paths, such as /dev/mapper/mpath1 or /dev/mapper/mpatha for device-mapper-multipath, /dev/emcpowera for EMC PowerPath, or /dev/sddlmab for Hitachi HDLM. 

- Since each LUN has multiple device nodes in /dev that point to the same underlying data, they all contain the same LVM metadata and thus LVM commands will find the same metadata multiple times and report them as duplicates

This is only a warning message and does not indicate a failure in LVM operation. Rather, system alerts the administrator that only one of the device is used as a PV and rest are being ignored.

To avoid this situation, a filter with only the needed devices should be included.

For example, to allow the internal disks in HP arrays and any EMC Powerpath devices, the filter would like


filter = [ “a|/dev/cciss/.*|”, “a|/dev/emcpower.*|”, “r|.*|” ]

After applying the filter

# rm -rf /etc/lvm/cache/.cache/

# pvscan

# vgscan

# lvscan

Do a #vgs -vv to cross check as well.

There are scenarios where a working filter may have failed and you may see duplicate entries which should not be visible…

- Device names and the filter patterns for the devices in lvm.conf

- Any changes made to the lvm.conf and the initrd not recompiled to reflect the changes.

No comments: