RHEL9 lvm2 cannot find imported VG physical volumes.
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
lsblkandlsscsithey are not found by LVM2. pvscan --cachereportsexcluded 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 multipathedvgimportdevices -awill 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_devicesfileis enabled, LVM2 will use the/etc/lvm/devices/system.devicesfile to identify which disks are PV’s for this install. The/etc/lvm/lvm.conffilters 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.devicesfile does not exists LVM will run as ifuse_devicesfile = 0is set and use the/etc/lvm/lvm.conffilters. -
If the
/etc/lvm/lvm.confuse_devicesfileparameter is set to0. The/etc/lvm/devices/system.deviceswill not be used and the/etc/lvm/lvm.conffilters are used. -
This is documented in the man pages for lvmdevices and vgimportdevices of the command help.
Diagnostic Steps
lsscsiand\ormultipath -llshow the imported disks are attached.-
lvm2 command
pvsdoes not show the disks or multipath map. -
Running
pvscan –-cache [device_name]returns the errorpvscan[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
-
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.