WARNING: PV /dev/sdxx in VG vgname is using an old PV header, modify the VG to update

Written by - 1 comments

Published on - last updated on March 9th 2023 - Listed in Linux


After upgrading an Ubuntu 16.04 (Xenial) to 20.04 (Focal), the following warning was seen, whenever update-grub is launched (automatically runs during a Kernel update):

/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.0-66-generic
Found initrd image: /boot/initrd.img-5.4.0-66-generic
Found linux image: /boot/vmlinuz-4.15.0-136-generic
Found initrd image: /boot/initrd.img-4.15.0-136-generic
Found linux image: /boot/vmlinuz-4.4.0-166-generic
Found initrd image: /boot/initrd.img-4.4.0-166-generic
  WARNING: PV /dev/sda5 in VG vgsystem is using an old PV header, modify the VG to update.
done

This obviously concerns the Linux Logical Volume Manager (LVM).

But why does this show up and how can this be fixed?

Where does this warning come from?

This warning is an output from yet another command: vgck. This can be manually verified:

root@focal:~# vgck -v vgsystem
  WARNING: PV /dev/sda5 in VG vgsystem is using an old PV header, modify the VG to update.

The purpose of vgck is, as the name already hints, to perform an integrity check of the LVM volume group(s) (VG) on the system. The metadata of each physical volume (PV) is checked. Just as a RAID array stores metadata on the drive, LVM does the same and stores meta information in each PV.

With the Ubuntu release upgrade, a new version of LVM was installed. On a Xenial system, LVM 2.02 is installed, on a Focal system the newer LVM 2.03 can be found in the package list.

root@xenial:~# dpkg -l|grep lvm2
ii  liblvm2app2.2:amd64    2.02.133-1ubuntu10   amd64        LVM2 application library
ii  liblvm2cmd2.02:amd64   2.02.133-1ubuntu10   amd64        LVM2 command library
ii  lvm2                   2.02.133-1ubuntu10   amd64        Linux Logical Volume Manager

root@focal:~# dpkg -l|grep lvm2
ii  liblvm2app2.2:amd64    2.02.176-4.1ubuntu3.18.04.3   amd64        LVM2 application library
ii  liblvm2cmd2.02:amd64   2.02.176-4.1ubuntu3.18.04.3   amd64        LVM2 command library
ii  liblvm2cmd2.03:amd64   2.03.07-1ubuntu1              amd64        LVM2 command library
ii  lvm2                   2.03.07-1ubuntu1              amd64        Linux Logical Volume Manager

With the upgrade from LVM 2.02 to 2.03 a new metadata format was introduced. On the LVM changelog a lot of metadata changes can be found in the 2.03 releases. One version (2.03.05) in particular is interesting:

Version 2.03.05 - 15th June 2019
================================
  Fix command definition for pvchange -a.
  Add vgck --updatemetadata command that will repair metadata problems.
  Improve VG reading to work if one good copy of metadata is found.
  Report/display/scan commands that read VGs will no longer write/repair.
  Move metadata repairs from VG reading to VG writing.
  Add config setting md_component_checks to control MD component checks.
  Add end of device MD component checks when dev has no udev info.

This means that LVM 2.03.05 added a new (sub-) command to vgck to update or migrate older metadata to the new format.

Updating metadata on the volume group(s)

The mentioned sub-command --updatemetadata can now be used to update the metadata on the volume groups mentioned in the warning:

root@focal:~# vgck --updatemetadata vgsystem
  WARNING: PV /dev/sda5 in VG vgsystem is using an old PV header, modify the VG to update.
  WARNING: updating PV header on /dev/sda5 for VG vgsystem.

Running a basic vgck against the volume group again and no warning shows up anymore:

root@focal:~# vgck vgsystem
root@focal:~#

One-liner to update PV header on all volume groups

With the following handy one-liner you can quickly update all PV headers on all volume groups on that system:

root@linux:~# for vg in $(vgdisplay 2>/dev/null | grep "VG Name" | awk '{print $NF}'); do vgck --updatemetadata ${vg}; done



Add a comment

Show form to leave a comment

Comments (newest first)

Lance from British Columbia, Canada wrote on Sep 21st, 2021:

Super helpful. Thank you!


RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Icingaweb   Icingaweb2   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder   


Update cookies preferences