WARNING: PV /dev/sdX in VG vgXX is using an old PV header, modify the VG to update
Environment
- Red Hat Enterprise Linux 8
- LVM
Issue
-
Warning appears when running
pvs, vgs, lvs
command to update volume group metadata:WARNING: PV /dev/vdb in VG vg_test is using an old PV header, modify the VG to update.
Resolution
-
In order to clear those warnings, Update
volume group metadata
by using the below command. This will apply corrections and updates to any metadata issues present, including updating thepv_header_extension.version
to the current/correct value of '2'.# vgck --updatemetadata vg_test
Root Cause
-
The root cause is the
pv_header_extension.version
field in RHEL8 environment is expected match the currentPV_HEADER_EXTENSION_VSN
(2), but does not:# pvck --dump headers /dev/<device-named-in-warning-message> : pv_header_extension.version 1 <==== out of date version, old structure format.
-
These warnings come continuously when a device is moved directly from
RHEL
version 5 to 8 systemwithout exporting/importing
a VG. Every time an lvm command is run, warnings will be generated. -
These warnings appear when a device moves from RHEL 5 to 6
then
RHEL 6 to 7 and finally to RHEL 8.- The
pv_header_extension
lvm2 data structure was not present in RHEL 5. -
The
pv_header_extension
lvm2 data structure was added in RHEL 6 with a version number of '1':File Function Line 0 layout.h <global> 26 #define PV_HEADER_EXTENSION_VSN 1 1 text_label.c _text_write 126 pvhdr_ext->version = xlate32(PV_HEADER_EXTENSION_VSN); #define PV_HEADER_EXTENSION_VSN 1 struct pv_header_extension { uint32_t version; uint32_t flags; <== unused flags, no values defined. /* NULL-terminated list of bootloader areas */ struct disk_locn bootloader_areas_xl[0]; } __attribute__ ((packed));
-
The current
pv_header_extension
had its version number increased to '2' within RHEL 7.9 release when theflags
entry within the above structure had changes to itsflags
value (in RHEL6 that field was not used). However, there was no uniform method of detecting old LVM2 metadata version information within thepv_header_extension
within RHEL 7 and notifying users./* * PV header extension versions: * - version 1: bootloader_areas_xl support (flags unused) * - version 2: PV_EXT_USED flags support added */ #define PV_HEADER_EXTENSION_VSN 2 struct pv_header_extension { uint32_t version; <=== expected to be '2' uint32_t flags; <=== flags used /* NULL-terminated list of bootloader areas */ struct disk_locn bootloader_areas_xl[0]; } __attribute__ ((packed));
-
Within RHEL 8, the LVM2 metadata checks performed on PVs was separated from other code paths and re-written to provide more consistent warnings when on-disk metadata failed sanity checks, including checking the value of
pv_header_extension.version
field.[...] 69 ext_version = lvmcache_ext_version(info); 70 if (ext_version < PV_HEADER_EXTENSION_VSN) { <<< Current version is '2' 71 log_warn("WARNING: PV %s in VG %s is using an old PV header, modify the VG to update.", 72 dev_name(pvl->pv->dev), vg->name); <<< printed here 73 continue; 74 } 75 [...]
- The
-
The recommended way of moving a data VG is using
vgexport/vgimport
. You may refer to "How do I move a Volume Group from one system to another?" for additional information.
Diagnostic Steps
-
Running any LVM command gives the warning:
[root@rhel8 ~]# pvs WARNING: PV /dev/vdb in VG vg_test is using an old PV header, modify the VG to update. PV VG Fmt Attr PSize PFree /dev/vda2 rhel lvm2 a-- <9.00g 0 /dev/vdb vg_test lvm2 a-- 1020.00m 0 [root@rhel8 ~]# lvs WARNING: PV /dev/vdb in VG vg_test is using an old PV header, modify the VG to update. LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert root rhel -wi-ao---- <8.00g swap rhel -wi-ao---- 1.00g lv1 vg_test -wi-a----- 1020.00m
-
Reproducer steps:
-
Method 1:
- Create a PV/VG/LV and file system on RHEL 5. - Detach the disk and attach it to RHEL 8. - Run lvm commands: [root@rhel8 ~]# lvs WARNING: PV /dev/vdb in VG vg_test is using an old PV header, modify the VG to update. LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert root rhel -wi-ao---- <8.00g swap rhel -wi-ao---- 1.00g lv1 vg_test -wi-a----- 1020.00m
-
Method 2:
- Create a PV/VG/LV and file system. Export the VG. - Detach the disk and attach it to RHEL 8 and run lvm commands before doing vgimport. [root@rhel8 ~]# pvs WARNING: PV /dev/vdd in VG vg_new is using an old PV header, modify the VG to update. PV VG Fmt Attr PSize PFree /dev/vda2 rhel lvm2 a-- <9.00g 0 /dev/vdb vg_test lvm2 a-- 1020.00m 0 /dev/vdc vg1 lvm2 a-- 508.00m 0 /dev/vdd vg_new lvm2 ax- 716.00m 0 <<<<<< [root@rhel8 ~]# vgimport vg_new WARNING: PV /dev/vdd in VG vg_new is using an old PV header, modify the VG to update. WARNING: updating PV header on /dev/vdd for VG vg_new. Volume group "vg_new" successfully imported [root@rhel8 ~]# pvs PV VG Fmt Attr PSize PFree /dev/vda2 rhel lvm2 a-- <9.00g 0 /dev/vdb vg_test lvm2 a-- 1020.00m 0 /dev/vdc vg1 lvm2 a-- 508.00m 0 /dev/vdd vg_new lvm2 a-- 716.00m 0
-
-
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.
Comments