Sep 182011

I had a development desktop fail and had to extract the data from the LVM managed hard drive. Easy, right? Pull out the drive, hook it up to an enclosure, plug into a laptop USB port and suck all the data down. And typically, it wasn’t that simple. The following error message appeared:

   # mount /dev/sdb1 /mnt
unknown filesystem type lvm2_member

Blast. Turns out, this disk has been part of an LVM volume group and the laptop didn’t know anything about this configuration. The solution, fortunately, is simple.

Install LVM, if it isn’t already:

   # apt-get install lvm2

List physical volumes, and their labelled volume groups:

   # pvs
  PV         VG         Fmt  Attr PSize  PFree
  /dev/sdb1  VolGroup01 lvm2 a-   27.95g 22.95g

There’s a volume group, VolGroup01, which I do vaguely remember configuring. So, scan for this, make active, scan for logical volumes and mount. That’s it, like so:

   # vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "VolGroup01" using metadata type lvm2

   # vgchange -a y VolGroup01
  1 logical volume(s) in volume group "VolGroup01" now active

   # lvscan
  ACTIVE            '/dev/VolGroup01/dataVol00' [5.00 GiB] inherit

   # mount /dev/VolGroup01/dataVol00 /mnt

And now the data on the stray disk is available, mounted under /mnt. Do with it what you will.

Matt Parsons is a freelance Linux specialist who has designed, built and supported Unix and Linux systems in the finance, telecommunications and media industries.

He lives and works in London.