How do I recover a physical volume's metadata?

Updated

Symptoms:

When an "incorrect metadata area header checksum" error message or an error message about not being able to find Physical Volumes with UUID is generated, it means that either the volume group descriptor area is corrupted or Logical Volume Manager (LVM) startup can not occur.

Note: Use this FAQ only for non-functional Volume Groups. Do not use this on a properly working LVM. Specify the correct physical volume to the pvcreate command or data may be LOST.

Solution:

Extract the exact uuid for the Physical Volume that was overwritten from the file /etc/lvm/archive/VolumeGroupName_XXXXX.vg (Where XXXXX represents the number of the last known good archived lvm metadata). An example of a uuid can be "2jRzVk-PZvN-JMLF-aMQ6-9pdh-DEQm-WM1Obg".

Use pvcreate to restore the metadata:

#pvcreate --uuid "<UUID>" --restorefile /etc/lvm/archive/VolumeGroupName_XXXXX.vg <PhysicalVolume>

The on-disk lvm metadata takes at least so much space as what it was overwritten with. The above command has been know to recover a PV overwritten with mkswap. If whatever overwrote the VGDA writes past that area, LVs may be affected. In this case, fsck might be able to fix the filesystem on the LV, or more drastic measures might be required to pull data off of it.

Tags
Article Type