I wanted to access the contents of a hard drive containing a logical volume group. This happened to be a drive that I had removed from an Ubuntu Linux system and I needed to grab some files from it.
First make sure you have the lvm2 tools. On Ubuntu or other Debians:
sudo apt install lvm2
Make sure you system is aware of all the attached physical volumes (This step might not be necessary, but shouldn’t hurt. It wasn’t necessary in my case, but others reported that it was):
sudo pvscan --cache
The output will be a list of physical volumes that are online. The disk containing the logical volume you want to mount should be there.
Find the name of your volume group by scanning for the available volume groups:
sudo vgscan
On my system the output looked like this:
Found volume group "ubuntu-vg" using metadata type lvm2
So ‘ubuntu-vg’ is the name of the volume group I want to access. Now activate the volume group:
sudo vgchange -ay your-vg-name
In my case, I used ‘ubuntu-vg’ in place of ‘your-vg-name.’ The ‘a’ flag means to activate the vg and the ‘y’ means don’t ask questions, just say yes to everything. The man page for vgchange says to use ‘-y’ “with extreme caution.”
The output of this command shows me that there is now 1 active logical volume in my volume group. It looks like this:
1 logical volume(s) in volume group "ubuntu-vg" now active
Now we can find the name of the logical volume:
sudo lvs
On my system the output of lvs was:
LV VG Attr LSize Pool Origin <truncated to prevent wrapping>
ubuntu-lv ubuntu-vg -wi-a----- 200.00g
This tells me that my volume group (VG) ‘ubunut-vg’ has 1 logical volume (LV) called ‘ubuntu-lv.’ The LVs can be found under /dev using /dev/volume-group/logical-volume. In my case, the device I want to mount is /dev/ubuntu-vg/ubuntu-lv.
Create a mount point for the volume (optional if you already have a place to mount it). I’ll just put it in under /mnt (the usual place):
sudo mkdir /mnt/ubuntu-volume
Now mount it. The mount command in my case will be:
sudo mount /dev/volume-group/logical-volume /mnt/your-mount-point
In my case the mount command was:
sudo mount /dev/ubuntu-vg/ubuntu-lv /mnt/ubuntu-volume
Enjoy!