Restore missing LVM volume group

This post will show you how I managed to restore my laptop after the grub configuration got corrupted and could not find the LVM root partition.
The grub menu booted into grub-rescue which I could not use to boot the LVM partitions as it was an unrecognised file system. Therefore the only thing to do was boot into a LIVE system. I tried several but ended up using an Arch system as I could potentially chroot into the installed system.

Within the live cd I could see the /dev/sd* devices and their partitions which were described as lvm by using the parted application.
Type

and then

to show the partitions.

Before you try to reinstall grub, the root partition needs to be mounted. Without LVM then it would be simple:

However with lvm the system does not recognise it and says it can’t mount it (mount: unknown filesystem type ‘LVM2_member’). So all the posts I found suggested doing a pvscan to scan for the physical lvm volumes followed by a vgscan.

This is from my working system. When I was booted from a live cd then “in use” was 0. The vgscan said no volumes found. Trying a “vgchange -ay” had no affect as it could not find the volumes. I eventually found the command “vgcfgrestore” which restored the volume group and then I was able to run the “vgchange -ay” to activate it.

Now you can show the logical volumes.

Now you can mount the lvm logical volume.

Now you can arch-chroot. This takes you into the mounted root volume so you can run commands as if you were booted into that root partition.

Now it’s time to fix grub. To reinstall grub and then generate a configuration file you need to run the following commands.

To clean up. Exit the chroot, umount the lvm volume and reboot.

References:

Arch Wiki Grub

Please share 🙂