Skip to contentSkip to conversation

Partition Recovery in LVM

linux-lvm Andrew Ragone 3 participants 4 messages Aug 16, 2010

lore
Share & tools
lore
#0 lore raw

I've been searching like crazy to find an answer to this question to no
avail: when you restore a backup of LVM does the backup contain partition table information as well?

I recently recovered an LVM that had a partition inside of it, but it has since been unable to mount. Most recovery utilities such as TestDisk will only find the LVM so I'm unsure of how to proceed and "recover" the partition.

-Andrew

#1 lore raw
Quoted 3 lines · Andrew Ragone

I�ve been searching like crazy to find an answer to this question to no avail:
when you restore a backup of LVM does the backup contain partition table information as well?

No; LVM2 sits a level above partitioning. If you had a partition table on the devices that were being used by LVM2 when you backed up you should put it back before you restore (and back it up separately of course).

Note also that if you were using partitions then you'll need to re-create the PVs on the appropriate partitions after restoring those before you can restore the LVM2 metadata.

If you're just using whole-disk devices then there are no partitions or partition tables to worry about.

If you mean partition tables that are stored _inside_ logical volumes (e.g. where the LV is a whole-disk image for a virtual machine containing partitions) then the answer's no as well; in this case the partition table is just ordinary data on the LV and LVM2 doesn't know or care about it at all (so you need to back it up separately, just like any other data stored in an LV).

Quoted 3 lines

I recently recovered an LVM that had a partition inside of it, but it has since been unable to mount. Most recovery utilities such as TestDisk will only find the LVM so I�m unsure of how to proceed and �recover� the partition.

Run the tools agains the logical volume (LV), not the physical volume (PV).

Regards,
Bryn.

#2 lore raw
In reply to Andrew Ragone
Quoted 2 lines · Andrew Ragone

I�ve been searching like crazy to find an answer to this question to no avail: when you restore a backup of LVM does the backup contain partition table information as well?

What kind of backup are you taking? Agent Client based or SAN snapshot based?

Quoted 4 lines

I recently recovered an LVM that had a partition inside of it, but it has since been unable to mount. Most recovery utilities such as TestDisk will only find the LVM so I�m unsure of how to proceed and �recover� the partition.

I don't know the exact lvm commands off the top of my head, but first I think you need to import the VG with something like 'vgimportclone' and then once the volume group is imported you should be able to see the partitions that reside in the VG. Not sure but you may need to run a 'kpartx -a' to get the kernel to see the new partitions that are available in the VG. Then I think it should be a matter of mounting the partition in /dev/mapper/<VG>

Quoted 8 lines

-Andrew

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

--
Romeo Theriault
System Administrator
Information Technology Services
Ph#: 207-561-3517
Em@: [email protected]

#3 lore raw
Quoted 7 lines · Romeo Theriault
Quoted 2 lines · Andrew Ragone

I�ve been searching like crazy to find an answer to this question to no avail: when you restore a backup of LVM does the backup contain partition table information as well?

What kind of backup are you taking? Agent Client based or SAN snapshot based?

Quoted 1 line
Quoted 6 lines
Quoted 3 lines

I recently recovered an LVM that had a partition inside of it, but it has since been unable to mount. Most recovery utilities such as TestDisk will only find the LVM so I�m unsure of how to proceed and �recover� the partition.

I don't know the exact lvm commands off the top of my head, but first I think you need to import the VG with something like 'vgimportclone'

Only if you're backing up the VG by cloning the storage (SAN clone/snap, dd image, MD split mirror etc.).

Quoted 5 lines

and then once the volume group is imported you should be able to see the partitions that reside in the VG. Not sure but you may need to run a 'kpartx -a' to get the kernel to see the new partitions that are available in the VG. Then I think it should be a matter of mounting the partition in /dev/mapper/<VG>

This is only needed if the LVs contain partition tables themselves (e.g. VM storage). Any partitions containing PVs on the cloned storage should be detected automatically by the kernel.

Regards,
Bryn.