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.

[root]# 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.

6 Comments

sriharish (not verified)
September 8th, 2010 12:43 pm
this Ariticle is very good but why cant we use mount /dev/sda2 /mnt to mount the LVM partion. any issues involved, why do linux uses LVM ? Thanks, Sriharish
LazyO> (not verified)
September 11th, 2010 10:26 am
From the Arch Linux Wiki, here are some reasons why we use LVM.
LVM is a Logical Volume Manager for the Linux kernel. With LVM you can abstract your storage space and have "virtual partitions" which are easier to modify. The basic building blocks of LVM are:
-Physical volume (PV): Partition on hard disk (or even hard disk itself or loopback file) on which you can have volume groups. It has a special header and is divided into physical extents. Think of physical volumes as big building blocks which can be used to build your hard drive.
-Volume group (VG): Group of physical volumes that are used as storage volume (as one disk). They contain logical volumes. Think of volume groups as hard drives.
-Logical volume (LV): A "virtual/logical partition" that resides in a volume group and is composed of physical extents. Think of logical volumes as normal partitions.
-Physical extent (PE): A small part of a disk (usually 4MB) that can be assigned to a logical Volume. Think of physical extents as parts of disks that can be allocated to any partition.
With LVM you can more easily handle your partitions (logical volumes) than normal hard drive partitions. For example, you can:
-Use any number of disks as one big disk(VG)
-Have partitions(LV) stretched over several disks (they can be as big as all of your disk storage together)
-Resize/create/delete partitions(LV) and disks(VG) as you like (it doesn't depend on position of the logical volumes within volume groups as with normal partitions)
-Resize/create/delete partitions(LV) and disks(VG) online (filesystems on them still need to be resized, but some support online resizing)
-Name your disks(VG) and partitions(LV) as you like
-Create small partitions(LV) and resize them "dynamically" as they get more filled (growing must be still done by hand, but you can do it online with some filesystems)
LazyO> (not verified)
September 8th, 2010 01:30 pm
An excellent article - this is what I usually do (originally from http://www.linuxjournal.com/article/8874 , page 3, "Listings" 7 & 8) 1. Become root: sudo su - 2. Scan for logical volume systems and output detailed information: pvscan 3. Change VolGroupXX to active: vgchange VolGroupXX -a y 4. Scan VolGroupXX for logical volumes: lvscan 5. Mount a selected logical volume: mount /dev/VolGroupXX/LogVolXX /mnt I've always found Step 3 to be necessary, but I'm usually using a LiveCD at the time, so that may be why.
Paul Maddox (not verified)
December 31st, 2010 04:00 pm
Many thanks for the pointer on making the vg active. That's missed in a lot of tutorials.
Fernando H Rosa (not verified)
April 17th, 2011 08:08 am
Ditto here. it wasn't active in my case as well (mounting from an external hd case).
Jon W (not verified)
March 10th, 2011 07:19 pm
Great stuff - I'd tried a couple of things to get an LVM to mount, to no avail. This was dead easy and took abouit 3 mins. Cheers, Jon

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <img> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <h1> <h2> <h3> <h4> <h5> <h6> <p> <br>
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Image links with 'rel="lightbox"' in the <a> tag will appear in a Lightbox when clicked on.

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.