Mount LVM Partitions

Sometimes you might need to access an LVM partition that resides on an disk but is not automatically mounted by the system. For example, hooking an external HDD or SSD that was formatted using LVM won't automatically mount (or even give you access) to the LVM partitions it contains.

Of course you'll need the LVM2 package installed (which should be the case on LMDE2). A full reference regarding this package can be accessed on this page of the Debian wiki.

To check wether the lvm2 package is installed on your system, use:

> sudo apt-cache policy lvm2
  Installed: 2.02.111-2.2+deb8u1
  Candidate: 2.02.111-2.2+deb8u1
  Version table:
 *** 2.02.111-2.2+deb8u1 0
        500 jessie/main amd64 Packages
        100 /var/lib/dpkg/status

In case you get a line saying Installed: (none), you'll need to install the package, then start the service:

> sudo apt-get install lvm2
> /etc/init.d/lvm2 start

We consider having an internal device containing the vg01 volume group, while the one on the external device is vg00. Connect the external device to the system, then use the following commands:

> sudo vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "vg00" using metadata type lvm2
  Found volume group "vg01" using metadata type lvm2
> sudo vgchange -a y

Now, all the LVM partitions should have devices created in the form /dev/volumegroup/logicalvolume:

> lsblk
sda             8:0    0 931.5G  0 disk 
├─sda1          8:1    0     2G  0 part [SWAP]
├─sda2          8:2    0    20G  0 part /
└─sda3          8:3    0 909.5G  0 part 
  ├─vg01-opt  254:2    0    20G  0 lvm  /opt
  └─vg01-home 254:3    0 889.5G  0 lvm  /home
sdb             8:16   0 232.9G  0 disk 
├─sdb1          8:17   0    18G  0 part 
├─sdb2          8:18   0     2G  0 part 
└─sdb3          8:19   0 212.9G  0 part 
  ├─vg00-opt  254:0    0    10G  0 lvm  
  └─vg00-home 254:1    0 202.9G  0 lvm

It is now possible to mount the LVM partitions as any other partition:

> sudo mount /dev/vg00/home /mnt/mountpoint

In case the volume group standing on the external device has the same name as your internal one, you won't be able to access both at the same time. In this situation first eject the external device, then rename your internal volume group (here vg00):

> sudo vgscan
> sudo vgchange -a n
> vgrename vg00 vg01

Then reconnect the external device and issue:

> sudo vgscan
> sudo vgchange -a y