Ubuntu – Recover data from ubuntu encrypted drive (LUKS)

hard driveluksUbuntu

I had a Host with Ubuntu 12.10 installed, and the entire harddrive was encrypted (with LUKS it appears), I remember the passphrase, but I have trouble to "open it".

I am now on a beta version of Ubuntu 14.04, installed on a new harddrive. the old hard-drive is also still connected. the new drive is sda and the old drive is sdb

when I try to open the drive in "files" it ask for the passphrase, and when entered says that it does not find a filesystem.

I googled it and found this:

sudo cryptsetup luksOpen /dev/sdb5 myopen

and

sudo mount /mnt/open

with a fstab like this

/dev/mapper/myopen /mnt/open ext4 defaults,noauto 0 1

but I get this error:

mount: wrong fs type, bad option, bad superblock on /dev/mapper/myopen,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

Best Answer

After some trial and error, and some more google, I came accross the solution. I think others might enjoy this, so I answer myself:

it turns out that the drive is a LVM (http://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux))

so, to fix this I do the following:

install LVM (this is for ubuntu)

apt-get install lvm2

modprobe dm-mod

scan the disks for volume groups

vgscan

change volume group to the one I just found above, in my case ubuntu-vg

vgchange -ay ubuntu-vg

find out about my locical volumes:

lvs

create a place to mount it:

mkdir /mnt/open

then use the above information to mount the volume

mount /dev/ubuntu-vg/root /mnt/open -o ro,user

then you can go to the open disk like this

cd /mnt/open

in my case I just want to recover some important files, then reformat. so case closed

Related Topic