How to decrypt a hard drive with LUKS encryption?

20,625

Have you tried something similar to this from for example a live OS or rescue boot menu from a linux installation media (cd dvd usb etc...)

$ sudo cryptsetup luksOpen /dev/sd<yourEncryptedDiskId> <aNameThatwillBeCreatedIn:Dev/mapper> 

Like for exemple :

$ sudo cryptsetup luksOpen /dev/sda tmpData 

and then

$ sudo mount /dev/mapper/<TheNameUsedEarlier> /mnt #wherever you want

so as in the exemple :

$ sudo mount /dev/mapper/tmpData  /mnt #wherever you want

now you can access your data.

Now that what needed to be done is done you can close the device :

$ sudo umount /mnt  
$ sudo cryptsetup luksClose  tmpData
Share:
20,625

Related videos on Youtube

Pau Chittaro
Author by

Pau Chittaro

Updated on September 18, 2022

Comments

  • Pau Chittaro
    Pau Chittaro almost 2 years

    today i was installing ubuntu on an external hard drive and in the initial setup i marked the option "encrypt installation" and the clicked the install button, but i didn't notice that my internal hard drive(which has windows 10 into it) was selected.

    When i clicked install a pop up showed up saying that 3 partitions were going to be deleted, so at that moment i noticed i choose the wrong drive, i cancelled the installation, went back, choose the right drive and i continued with the installation (This time i left the encrypt option disabled).

    So far, so good with ubuntu, but when i failed to boot from windows i realized that i encrypted the whole drive!

    I need the files back, i have no idea what to do next! Please help, i read i needed to do a back up, but i dont even know how to access the drive. Any comments or suggestion will we welcome.

  • Pau Chittaro
    Pau Chittaro over 6 years
    Hello, @M4rty after entering the pass phrase i get "Cannot use device /dev/sda3 which is in use (already mapped or mounted)." Any Ideas?
  • M4rty
    M4rty over 6 years
    when you type $ sudo mount , is sda3 listed?
  • Pau Chittaro
    Pau Chittaro over 6 years
    I restarted Ubuntu, and it let me see the device in which is created: sda 8:0 0 931,5G 0 disk ├─sda1 8:1 0 512M 0 part ├─sda2 8:2 0 488M 0 part └─sda3 8:3 0 930,5G 0 part └─sda5_crypt 252:0 0 930,5G 0 crypt Now i don't know what to do, if i try to mount it i get "mount: unknown filesystem type 'LVM2_member'"
  • Mikolasan
    Mikolasan over 3 years
    @PauChittaro Do you have LVM installed? sudo apt install lvm2