Installation guide

Table Of Contents
4. Recovering Physical Volume Metadata
If the volume group metadata area of a physical volume is accidentally overwritten or otherwise
destroyed, you will get an error message indicating that the metadata area is incorrect, or that
the system was unable to find a physical volume with a particular UUID. You may be able to re-
cover the data the physical volume by writing a new metadata area on the physical volume spe-
cifying the same UUID as the lost metadata.
Caution
You should not attempt this procedure with a working LVM logical volume. You will
lose your data if you specify the incorrect UUID.
The following example shows the sort of output you may see if the metadata area is missing or
corrupted.
[root@link-07 backup]# lvs -a -o +devices
Couldn't find device with uuid 'FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk'.
Couldn't find all physical volumes for volume group VG.
Couldn't find device with uuid 'FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk'.
Couldn't find all physical volumes for volume group VG.
...
You may be able to find the UUID for the physical volume that was overwritten by looking in the
/etc/lvm/archive directory. Look in the file VolumeGroupName_xxxx.vg for the last known valid
archived LVM metadata for that volume group.
Alternately, you may find that deactivating the volume and setting the partial (-P) argument will
enable you to find the UUID of the missing corrupted physical volume.
[root@link-07 backup]# vgchange -an --partial
Partial mode. Incomplete volume groups will be activated read-only.
Couldn't find device with uuid 'FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk'.
Couldn't find device with uuid 'FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk'.
...
Use the --uuid and --restorefile arguments of the pvcreate command to restore the physical
volume. The following example labels the /dev/sdh1 device as a physical volume with the UUID
indicated above, FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk. This command restores the physical
volume label with the metadata information contained in VG_00050.vg, the most recent good
archived metatdata for volume group . The restorefile argument instructs the pvcreate com-
mand to make the new physical volume compatible with the old one on the volume group, en-
suring that the the new metadata will not be placed where the old physical volume contained
data (which could happen, for example, if the original pvcreate command had used the com-
mand line arguments that control metadata placement, or it the physical volume was originally
created using a different version of the software that used different defaults). The pvcreate com-
mand overwrites only the LVM metadata areas and does not affect the existing data areas.
[root@link-07 backup]# pvcreate --uuid "FmGRh3-zhok-iVI8-7qTD-S5BI-MAEN-NYM5Sk" --restorefile /etc/lvm/archive/VG_00050.vg /dev/sdh1
4. Recovering Physical Volume Metadata
63