RHEL9 lvm2 cannot find imported VG physical volumes.

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 8, 9, 10
  • lvm2-2.03.12-10.el8 and later

Issue

  • When trying to import foreign VG’s, while the physical volumes for the VG's are present in lsblk and lsscsi they are not found by LVM2.
  • pvscan --cache reports excluded by devices file (checking PVID).

Resolution

  • All Disks: If all disks on the RHEL server are PV’s to be used by this system then run the command vgimportdevices -a. If a LUN is multipathed vgimportdevices -a will only add the multipath map.

  • Some Disks: If only some of the disks contain PV’s to be used by this system run lvmdevices --adddev [device name] for each to be used device.
    For example:

    lvmdevices --adddev /dev/mapper/mpathc  
    
  • Shared Disks: If the volume group is a shared VG across all nodes in a Pacemaker cluster, see LVM-activate resource fails to start on passive node.

Root Cause

  • When use_devicesfile is enabled, LVM2 will use the /etc/lvm/devices/system.devices file to identify which disks are PV’s for this install. The /etc/lvm/lvm.conf filters are ignored. As the imported PV’s are not in this file LVM will not work with them.

  • If a RHEL8 system is upgraded to RHEL9 the /etc/lvm/devices/system.devices file does not exists LVM will run as if use_devicesfile = 0 is set and use the /etc/lvm/lvm.conf filters.

  • If the /etc/lvm/lvm.conf use_devicesfile parameter is set to 0. The /etc/lvm/devices/system.devices will not be used and the /etc/lvm/lvm.conf filters are used.

  • This is documented in the man pages for lvmdevices and vgimportdevices of the command help.

Diagnostic Steps

  • lsscsi and\or multipath -ll show the imported disks are attached.
    • lvm2 command pvs does not show the disks or multipath map.

    • Running pvscan –-cache [device_name] returns the error

      pvscan[xx] [device_name] excluded by devices file (checking PVID).

      For example the ldpath04 map below has been introduced and holds a to be imported
      VG.

        # multipath -ll 
      ldbackup (36001405e46d9356d0074f878c5212909) dm-2 LIO-ORG,backup
      size=1.0G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
      `-+- policy='round-robin 0' prio=50 status=active
        `- 9:0:0:88 sdg 8:96 active ready running
      ldpath04 (360014055acd50e8488f4a8da0ca0a3ce) dm-3 LIO-ORG,u10glv4
      size=10G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
      `-+- policy='round-robin 0' prio=50 status=active
        |- 6:0:0:4  sda 8:0  active ready running
        |- 7:0:0:4  sdc 8:32 active ready running
        `- 8:0:0:4  sde 8:64 active ready running
      
    • But the command pvs does not show /dev/mapper/rhpath04

      # pvs
       PV                   VG       Fmt  Attr PSize    PFree
       /dev/mapper/ldbackup ldbackup lvm2 a--  1020.00m    0 
       /dev/vda2            rhel     lvm2 a--    <9.00g    0 
      
    • Neither does pvscan

      # pvscan --cache 
        pvscan[68704] PV /dev/vda2 online.
        pvscan[68704] PV /dev/mapper/ldbackup online.
      
    • Trying to scan the device directly generates an error

      # pvscan --cache /dev/mapper/ldpath04
        pvscan[68784] /dev/mapper/ldpath04 excluded by devices file (checking PVID).
      
    • Running lvmdevices shows devmapper/ldpath04 is missing.

      lvmdevices
        Device /dev/mapper/ldbackup IDTYPE=mpath_uuid IDNAME=mpath-36001405e46d9356d0074f878c5212909 DEVNAME=/dev/mapper/ldbackup PVID=IuVSS4dZjE0WrmGlhFk3coYmxbV3pJqE
        Device /dev/vda2 IDTYPE=devname IDNAME=/dev/vda2 DEVNAME=/dev/vda2 PVID=VDoNwWJCHIuhc2j7eBwO1F66N2D57GYV PART=2  
      
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.