rebuild partition table with LVM physical volumes

How to use TestDisk to recover lost partition
Forum rules
When asking for technical support:
- Search for posts on the same topic before posting a new question.
- Give clear, specific information in the title of your post.
- Include as many details as you can, MOST POSTS WILL GET ONLY ONE OR TWO ANSWERS.
- Post a follow up with a "Thank you" or "This worked!"
- When you learn something, use that knowledge to HELP ANOTHER USER LATER.
Before posting, please read
Posts: 2
Joined: 29 Mar 2012, 17:59

rebuild partition table with LVM physical volumes

#1 Post by franz »

Hi everybody,

I happened to wipe out the beginning 1MB of a 2TB disk
which was partitioned with the following LVM scheme:
three LVM logical volumes (root/swap/home)
on two LVM physical volumes, namely,
two different partitions of this large disk
(the second one was added as a second LVM pv
after cloning a smaller 320GB disk which was to be replaced)

now, the testdisk advanced analysis seem to find the first partition correctly,
but sadly, it fails to detect the second one, therefore,
if I write the recovered partition scheme,
the "home" Logical Volume (which of course is the one I care of)
appears to be UNAVAILABLE

I was wondering what exactly does the "deep search" mode?
could it be that it misses the "signature" that marks the beginning
of the (much larger) second LVM physical volume?

I'm afraid I cannot make use of any LVM analysis/recovery tool
as long as I do not feed LVM the correct physical volume start and size


Francesco 'Franz' Castelli

Posts: 2
Joined: 29 Mar 2012, 17:59

Re: rebuild partition table with LVM physical volumes

#2 Post by franz »

Great news guys (at least for me)!

I succeeded to recover the whole LVM structure,
and even the boot capability via grub-install (whew!)

sadly, while the first PV was successfully detected
by testdisk 'deep search' mode, for the missing second PV
I had to work my way through the disk physical sectors using lde,
searching for the same data pattern that showed
in the beginning sectors of the first PV

once found that pattern, I did a trivial sector#-to-CHS conversion
and manually added the tentative third partition via testdisk
(I already knew that the partition spanned 'til the end of the physical disk)

I wonder why did testdisk fail to do what I did manually,
however, many, many thanks to Mr Cristophe Grenier
and to all the other guys and girls who helped writing,
fixing and improving testdisk !!!