Recover LVM Partitions In Linux

Have you ever undergone a situation in which you have extended or created an LVM partition but your disk got corrupted and the disks will not be shown while executing the PV(physical volume) display, LV(logical volume) display, and VG(volume group) display. Feel free as this blog aims to reveal the steps to recover the missing LVM partition data in Linux.

Steps to recover the partition

As we already know LVM has the feature of taking backups of the details of metadata regularly in /etc/lvm/backup/<vg_name> whenever we do any modifications. Now, please verify the file which have all the partitions and size.

Once we have verified all the settings, we need to take the backup of the file and reboot the server into rescue mode.

Once the server got booted to the rescue mode, unmount the root partition disk as like the below command.

After unmounting the root partition disks we need to verify whether all the partitions are unmounted and no mounted on the server. To check whether it is mounted or not use the below command.

After finishing the checking, upload the backup file of the local volume management’s (LVM) meta data in the rescue server and get the uuid of /dev/sda1 as like below,

Once you have done with the above steps now execute below command in order to create the physical volumes(PV),

Now, check whether the physical volume(PV) is created or not,

Next, we need to restore and sync the volume group(VG) by executing below command, and additionally in order to check whether the volume group is restored properly check by using the below command,

After creating and restoring the physical volume and volume group now we are heading towards the final part of the process (ie) restoring the LVM by using the below command,

If you get any error which is related to the lvm-thin, then you need the package “thin-provisioning-tools”. Install it by using the following command.

Bingo! we had successfully recovered the LVM partition. Now boot up your server into the normal mode and proceed with your operations.

Thank you for taking the time to read our blog on “Learn how to recover the LVM partitions in Linux?.” We hope you found the information valuable and insightful. If you find any issues with the information provided in this blog don’t hesitate to contact us (info@assistanz.com).