How to mount Linux LVM volume partitions on Linux
So, one of my friends had this weird system breakdown while upgrading Fedora from DVD. Grub couldn't locate the grub.cfg file. In order to fix the system and take a backup of some important files, we booted in a live session, mounted a lvm partition to find out that most of the data was gone . The end was pretty bad but I think, just like in my case, there will be many more who wouldn't know how to mount a lvm partition. This little adventure of mine might help you out.
In case you have to do something similar just follow the steps we took.
1) Once we were in live session, we opened a terminal and ran
[root]# fdisk -l
This lists out the partition table of the system and it looked something like this
Device Boot Start End Blocks Id System
/dev/sda1 * 1 4864 39070048+ 7 HPFS/NTFS
/dev/sda2 4865 6691 14675377+ 83 LVM2_member
2) The good news was that the system was at least able to distinguish the partitions. So, in order to backup the data, the next step was to access the /dev/sda2 partition. But since it is an lvm partition we will had to take some additional steps to mount it.
Now, run the pvs command. Please note that while in live session you may find that this is not installed by default. In order to install the required tools, run the following command.
[shredder12]$ sudo apt-get install lvm2
Of course, you should be connected to internet. Once you are done with this run pvs.
This will list the volume groups to which our physical volume /dev/sda2 belonged. It would be of the form
PV VG Fmt Attr PSize PFree
/dev/hda2 VolGroup01 lvm2 a- 148.94G 32.00M
The second field, VG, shows the Volume group. The above output is just an example, showing that we are concerned with the Volume group "VolGroup01". The next step is to list the information about this volume group.
[root]# lvdisplay /dev/VolGroup01
It will throw a bunch of ouput, but the one we are concerned with is LV Name. It will look something like this
LV Name /dev/VolGroup01/LogVol00
In our case, there were two entries of type LV Name, the other being LogVol01, the swap. The whole output along with it will help you to identify the target logical volume you are looking for. Assuming that the above one is the partition that we need to mount, just use the usual method to mount it.
[root]# mount /dev/VolGroup01/LogVol00 /mnt
Now, you can to find the data you were looking for in the /mnt folder.