Mounting an encrypted hard disk (LUKS)

I found a pretty good link from BIT ENGINE on rescuing data from a LUKS encrypted harddisk.

PROBLEM 1 – lvdisplay / vgchange not recognized

The first issue I ran into while using Ubuntu 9.10 liveCD, was the commands lvdisplay and vgchange were not recognized. So to fix this:

apt-get install lvm2

So now, on my system lvdisplay outputs:
--- Logical volume ---
LV Name /dev/vg_dvz/lv_root
VG Name vg_dvz
...etc...

If you
ls -la /dev/vg_dvz/lv_root

you’ll noticed that it’s linked to
/dev/mapper/vg_dvz-lv_root

PROBLEM 2 – Mounting Issues
While reading it and following it, at this point:

"Mount your filesystem:

mount -t ext4 /dev/volumename/root /mnt”

When trying to mount:
mount -t ext4 /dev/vg_dvz/lv_root /mnt

I kept getting the error:
mount: unknown filesystem type 'crypto_LUKS'

So to overcome that, I just executed the previous command
cryptsetup -v luksOpen /dev/mapper/vg_dvz-lv_root myroot

and entered my LUKS passphrase again…
mount /dev/mapper/myroot
…voila!

Takeaway

I had to apply the luksOpen on the Partition as well as the lv_root…sometimes only opening the partition may not suffice as each logical volume may also say it is of crypto_LUKS filetype.

Hope this saves someone some headache.

Advertisements