United States (change)
Shortcuts: Downloads Fedora Red Hat Network
Account Links: Cart Your Account Logout
This procedure requires a recent backup of the LVM configuration. This can be generated with the command vgcfgbackup and is stored in the file /etc/lvm/backup/<volume group name>. The /etc/lvm/archive directory also contains recent configurations that are created prior to any changes.
Assuming a physical volume has been lost that was a part of a volume group (for what ever reason), the following procedure can be followed. The procedure will add another physical volume to the volume group to restore the volume group status and access any data that may be able to be recovered.
The procedure for recovery is as follows:
Execute:
vgdisplay --partial --verbose
The out put will be similar to below:
Partial mode. Incomplete volume groups will be activated read-only.
Finding all volume groups
Finding volume group "volGroup00"
Couldn't find device with uuid ƏeWicl-1HSB-Fkcz-wrMf-DzMd-Dgx2-Kyc11j'.
Couldn't find device with uuid ƏeWicl-1HSB-Fkcz-wrMf-DzMd-Dgx2-Kyc11j'.
Couldn't find device with uuid ƏeWicl-1HSB-Fkcz-wrMf-DzMd-Dgx2-Kyc11j'.
Couldn't find device with uuid ƏeWicl-1HSB-Fkcz-wrMf-DzMd-Dgx2-Kyc11j'.
--- Volume group ---
VG Name volGroup00
System ID
Format lvm2
Metadata Areas 4
Metadata Sequence No 33
VG Access read
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 0
Max PV 0
Cur PV 5
Act PV 5
VG Size 776.00 MB
PE Size 4.00 MB
Total PE 194
Alloc PE / Size 194 / 776.00 MB
Free PE / Size 0 / 0
VG UUID PjnqwZ-AYXR-BUyo-9VMN-uSRZ-AFlj-WOaA6z
--- Logical volume ---
LV Name /dev/volGroup00/myLVM
VG Name volGroup00
LV UUID az6REi-mkt5-sDpS-4TyH-GBj2-cisD-olf6SW
LV Write Access read/write
LV Status available
# open 0
LV Size 776.00 MB
Current LE 194
Segments 5
Allocation inherit
Read ahead sectors 0
Block device 253:0
--- Physical volumes ---
PV Name /dev/hda8
PV UUID azYDV8-e2DT-oxGi-5S9Q-yVsM-dxoB-DgC4qN
PV Status allocatable
Total PE / Free PE 48 / 0
PV Name /dev/hda10
PV UUID SWICqb-YIbb-g1MW-CY60-AkNQ-gNBu-GCMWOi
PV Status allocatable
Total PE / Free PE 48 / 0
PV Name /dev/hda11
PV UUID pts536-Ycd5-kNHR-VMZY-jZRv-nTx1-XZFrYy
PV Status allocatable
Total PE / Free PE 48 / 0
PV Name /dev/hda14
PV UUID OtIMPe-SZK4-arxr-jGlp-eiHY-2OA6-kyntME
PV Status allocatable
Total PE / Free PE 25 / 0
PV Name unknown device
PV UUID 9eWicl-1HSB-Fkcz-wrMf-DzMd-Dgx2-Kyc11j
PV Status allocatable
Total PE / Free PE 25 / 0
The --partial flag is required to get the LVM tools to read partial volume group metadata, otherwise the command would fail because a physical volume is missing. Note the lines in the last entry that are bold. The PV UUID is needed for the next step. This contains the UUID of the physical volume that failed.
Now add in a fresh (or new) physical volume whether it be another hard drive or recreate a partition on an existing disk and execute:
pvcreate --restorefile /etc/lvm/backup/<volume group name> --uuid <uuid> <device>
Remember the UUID is the value taken from the output in step 1. So in this example the full command would be:
pvcreate --restorefile /etc/lvm/backup/volGroup00 --uuid 9eWicl-1HSB-Fkcz-wrMf-DzMd-Dgx2-Kyc11j /dev/hda15 Couldn't find device with uuid ƏeWicl-1HSB-Fkcz-wrMf-DzMd-Dgx2-Kyc11j'. Physical volume "/dev/hda15" successfully created
Now the new physical volume has been initiated with the UUID of the old physical volume we can now restore the volume groups metadata with:
vgcfgrestore --file /etc/lvm/backup/<volume group name > <volume group name>
In keeping with this example, the command would be:
vgcfgrestore --file /etc/lvm/backup/volGroup00 volGroup00 Restored volume group volGroup00
To check that the new physical volume is in tact and the volume group is functioning correctly, execute vgdisplay -v.
Note: This will not recover the data lost on the physical partition that failed, it is simply a way to rebuild the volume group without losing your entire configuration.