LVM Luks Cryptsetup Mount from Alternate Machine or VM

I’ve run into some problems lately as I decided to setup various configurations using encrypted drives, which also includes LVM by default. I accidentally stumbled across an article from 2008 posted on Ubuntu Geek which describes the process. The drive I used for testing was connected via VirtualBox with a USB Cable on a Macbook Pro running El Capitan. The operating system on the VM was Xubuntu 16.04 (an Ubuntu 16.04 derivative) and the original operating system on the encrypted drive was the same.

The link to the original article is: http://www.ubuntugeek.com/rescue-an-encrypted-luks-lvm-volume.html

This tutorial is for people who have encrypted their main volumes of their hard drives using the method offered by the Alternate CD installer.

First you need to Boot into a Live CD environment and open up a terminal window. (applications–>accessories—>terminal)

Install required packages using the following command

sudo apt-get install lvm2 cryptsetup

probe required module using the following command [I didn’t have to do this step]

sudo modprobe dm-crypt

setup the crypto module to recognise the partition

sudo cryptsetup luksOpen /dev/hda5 crypt1

Enter your passphrase. You should get the following message:

key slot 0 unlocked.
Command successful.
If not, something has gone wrong.

Scan for volume groups

sudo vgscan --mknodes

sudo vgchange -ay

[NOTE: You might receive multiple errors at this step about incorrect names, etc. The main take-away from this step is whether it admits to finding a volume.]

REMEMBER the name of the volume group, as you will need it later.

Create a mount point [I simply mounted to /mnt instead]

sudo mkdir /volume

mount the encrypted volume to the mountpoint you just created. [Substitute the volume group name found in place of the paulb-desktop in the next command]

sudo mount /dev/paulb-desktop/root /volume

The volume is mounted, now you can chroot or whatever else you need to do. If you would like to open the gnome file manager for writing to it issue the following command:

sudo nautilus /volume


At this point, hopefully it worked. I wish I’d found these instructions a couple of years ago as I’ve ended up trashing 2 volumes in the process of trying to recover files. Fortunately, I didn’t lose that much but it could have been truly catastrophic, especially had it been a production server.