recovering LUKS encrypted Ubuntu LV Group when mounting on a different Ubuntu system
I mirror my hdd, and keep swapping them in and out of test system. Often I mirror ( using external dock, such as - http://www.ebay.in/itm/Anker-Uspeed-USB-3-0-and-ESATA-To-SATA-External-Hard-Drive-Docking-Station-/161201311080 ). This leads to an issue.
Ubuntu during installl with luks+lvm configuration will name the vg as "ubuntu--vg". And when you plug in another drive on which ubuntu was installed, would lead to a naming conflict and failure to activate the lvm after luks open.
) Ubuntu will give you a passphrase dialog when you plug the device in (if you're in a gui) but will fail to mount after the password is entered. The reason for this is that the volume group of your old partition, and your current OS partition are the same. However, if you enter the password, it will still create a node in /dev/mapper/. If you run ls -la /dev/mapper/ you should see a luks-xxxxxx-xxxxx-xxxx or some such file. That's the mapping that was created when the password dialog failed. Note, that all the dialog did was to call: luksOpen and map it to that /dev/mapper/luks-xxx file.
1) Make sure your physical volume is available by running the pvdisplay command. It should be /dev/mapper/luks-xxx-whatever. Notice that the VG Name of both drives is the same; this is problematic and will prevent you from being able to mount the drives both at the same time (very frustrating).
2) To fix this, get the uuid of the volume by running "pvs -o +vg_uuid". The uuid will be the value displayed all the way to the right, containing 7 dash-delimited values. Copy those somewhere as we'll be using them in the next step. DO NOT CONFUSE UUIDS AND COPY DOWN THE WRONG ONE. Only copy the one for your current luks-xxx-whatever device.
3) Change the volume group for your old disk by running the following command "vgrename UUIDOFYOURDISKHERE oldhd" You can change the "oldhd" to whatever you want so long as it's differing from the volume group name of your current disk. Performing this step removes the conflict with volume group names which will allow you to now make volumes available.
4) Run the command "vgchange -a y" to make the volumes active.
5) Create a mount point somewhere, for example create mount point /mnt/oldhd/ by running mkdir /mnt/oldhd/.
6) Now, mount the root partition of the oldhd volume group by running the following command: "mount /dev/oldhd/root /mnt/oldhd"
7) You should now be able to cd into /mnt/oldhd and acc