LVM error “WARNING: Inconsistent metadata found” – How to resolve in CentOS / RHEL

What is inconsistent metadata error

When LVM performs pretty much any action, it first scans all available physical volumes and refreshes its view of the volume group layout. Because multiple physical volumes can exist in the same volume group, it is possible to end up in a situation where these PVs in the same VG reflect different information. In most cases, this results in the warning message “Inconsistent metadata found” error while executing any command like vgscan, pvscan. For example :

# vgscan
  Reading all physical volumes.  This may take a while...
  Volume group "vg_test" inconsistent
  WARNING: Inconsistent metadata found for VG vg_test - updating to use version 3
  Removing PV /dev/mapper/x (1nxHIW-2Thk-9mS4-2TzO-zHlB-Hsy2-CZsjE7) that no longer belongs to VG vg_test
  Found volume group "vg_test" using metadata type lvm2
Segmentation fault

There could be multiple causes for the inconsistent metadata error. And thus there is no exact resolution for this error. In most situations, restoring older versions of VG metadata with vgcfgrestore works.

Restoring VG metadata using vgcfgrestore

1. The volume group metadata may be restored with the following command:

# vgcfgrestore --file  /etc/lvm/backup/[volume group name] [volume group name]

2. Continuing the earlier error shown in ths post, the exact command would be:

# vgcfgrestore --file /etc/lvm/backup/vg_test vg_test
 Restored volume group vg_test

The name of the metadata backup file would be different that the one shown in above command. But it will include the name of the VG. You can check for the timestamp of the file and the content inside to be sure before executing the vgcfgrestore command.

3. To check that the new physical volume is intact and the volume group is functioning correctly execute vgdisplay -v.

# vgdisplay -v
Related Post