Home > Developer, File Systems, Guides & How-To, Linux/Unix, Operating Systems > Mounting and activating LVM Volumes from BootCD to recover data in linux

Mounting and activating LVM Volumes from BootCD to recover data in linux

September 2nd, 2009 Leave a comment Go to comments

I’ve been working heavily with Red Hat Enterprise Linux (and subsequently CentOS) the past few months (shh! dont tell my MSFT homey!) and one of the great things about CentOS and RHEL is that they both install using LVM – which is a helluvah lot easier when time passes and you realise your running out of space on a drive.

But today I had to recover some data from an LVM partition and copy over some bits to another partition without actually booting the CentOS install (it was bj0rked by yours truely!). What to do? Throw in a Ubuntu LiveCD (or another) and just mount the partitions 🙂

First thing we need to do is install LVM – remember we need to be sudo for these to work.

$ aptitude install lvm2

Then scan for any available physical volumes on any of the drives.

$ pvscan

Scan for any Volume Groups that may be present.

$ vgscan

Now activate any of the Volume Groups that it finds, running this makes the logical volumes known to the kernel.

$ vgchange –available y

Then let it scan for any Logical Volumes on any drives

$ lvscan

After running the logical volume scan it will show the path to the LVM mount path, for my boxen it gives something like this

ACTIVE            ‘/dev/LVM/Data‘ [5.26 TB] inherit

You simply mount the path specified and browse like normally 🙂

$ mount /dev/LVM/Data /mnt

Enjoy.

{lang: 'en-GB'}
Share
  1. Reinhard
    November 12th, 2012 at 23:30 | #1

    Hi Thushan,

    thank you for that easy-guide, it was exactly what I – completely unknown to using lvm – was needed. To run the commands even smoother you may want to change the following command:

    $ vgchange –available y

    so one can easily regognize the two dashes instead of one I-don’t-know-how-it’s-called longer “dash”.

    Anyway – THANK YOU!

    Best regards from Germany to the other side of our globe,
    Reinhard

  2. November 30th, 2012 at 20:51 | #2

    vgchange -a y
    6 logical volume(s) in volume group “TEMPLATEDebian64504” now active

    did the trick on debian.
    not:
    vgchange -available y

  3. kenby
    December 14th, 2012 at 21:48 | #3

    after I did the same that was in the article I’m still getting the error :
    $mount /dev/VPS/vm171_img /mnt
    mount: you must specify the filesystem type

    This is a xen (solusvm ) vps partition

  1. No trackbacks yet.