Much ado about scripting, Linux & Eclipse: card subject to change

2011-08-16

Mounting Linux LVM drives

Because my Thinkpad X200 has finally, after just under 3 years, decided to give up the ghost via a FAN ERROR and refusal to start (POST beeps & auto-shutdown), I'm now faced with the task of recovering all the data on the drive (about 120G) across multiple partitions.

Here's the drive layout, as per cfdisk:

                                   cfdisk (util-linux-ng 2.17.2)

                                        Disk Drive: /dev/sdb
                                 Size: 160041885696 bytes, 160.0 GB
                       Heads: 255   Sectors per Track: 63   Cylinders: 19457

     Name           Flags         Part Type    FS Type              [Label]            Size (MB)
 --------------------------------------------------------------------------------------------------
     sdb1                          Primary     NTFS                 [^B]                26214.44   *
     sdb2           Boot           Primary     Linux ext3                                 209.72   *
                                   Logical     Free Space                                   3.68   *
     sdb5                          Logical     Linux ext3           [HOME]             106043.70   *
     sdb6           NC             Logical     Linux LVM                                20970.48   *
                                   Logical     Free Space                                   1.09   *
     sdb4                          Primary     Compaq diagnostics                        6595.71   *
                                               Unusable                                     0.49   *

So, under a Fedora 13 LiveCD, the /boot (sdb2) and /home (sdb5) partitions automounted, along with the WinXP (sdb1) partition. But the root partition (/, part of sdb6) would not as it's part of a LVM. After a quick burst of googling, I found this solution, which digests down to simply this:

yum install lvm2 -y; # install support for lvm2
pvscan # scan vol groups
vgchange vg_x2lappy -a y # mark your vol group active
lvscan # scan for logical volumes 
mkdir /media/sdb6 # create a mount point
mount /dev/vg_x2lappy/lv_root /media/sdb6/ # mount the lv
cd /media/sdb6/; ls -la # take off every zig!