13.9. Recover physical volume metadata

If you get the warning "incorrect metadata area header checksum" or something about not being able to find PV with UUID foo, you probably toasted the volume group descriptor area and lvm startup can't occur.

WarningOnly run on non-functional VG
 

Don't do this on a properly working lvm. You need to specify the correct physical volume to pvcreate or you may lose your data.

Extract the exact uuid for the PV 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).

Use pvcreate to restore the metadata: pvcreate --uuid "<some_long_string>" --restorefile /etc/lvm/archive/VolumeGroupName_XXXXX.vg <PhysicalVolume>

If you are lucky you'll find that 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 you may need more drastic measures to pull data off of it. Contact your local friendly filesystem expert for help in that case.

Note

pvcreate only overwrites the lvm metadata areas on disk and doesn't touch the data areas (the logical volumes).

mirror server hosted at Truenetwork, Russian Federation.