Using testdisk to recover deleted lvm2 partition
I am using testdisk to recover a lost lvm2 partition. The volume group is using only a single physical volume (/dev/md1).
The command "testdisk /dev/md1" creates a list of possible partitions to recover (with a lot of junk). My lost partition was there, listed as a "Linux" partition.
However, i don't understand what to do now. Testdisk seems to only let me recover this as an ordinary partition. It shows the cylinder information, with start and end cylinder for the partition. Is it possible to use this to manually edit the lvm configuration in some way. Or can testdisk recover this as an lvm2 partition for me?
A partition is just a start and an end cylinder. If testdisk is correct that it starts where it starts and ends where it ends, then it doesn't matter what's inside because it's there.
If there is an lvm2 physical volume inside then recovering the partition will recover the physical volume. pvdisplay should detect it when it's recovered.
I solved this.
The lvm system maintains backup copies of the lvm configuration in the /etc/lvm/archive folder. I found the backup copy from just before my lvm volume was deleted. By using "vgcfgrestore" and the archive file i was able to restore the lvm configuration as it was before the lvm volume was deleted.
"vgcfgrestore -l VolGroup00" shows a list of backed up configurations. I found that the correct configuration was in the file "/etc/lvm/archive/VolGroup00_00054.vg".
Running "vgcfgrestore -f /etc/lvm/archive/VolGroup00_00054.vg" did the trick.
|All times are GMT -5. The time now is 10:10 PM.|