Ubuntu – Decrypt LUKS partition without losing data

16.04decryptionencryptionluks

I have a LUKS encrypted hard drive consisting of one single partition for the whole hard drive and it's encrypted with LUKS, I was wondering if I wanted to decrypt the disk completely(remove the encryption scheme) but retain the data is that possible or do I have to back the data up first.

td;lr = decrypt a LUKS disk completely without losing data, possible? how? or do I need to back it up first.

Best Answer

You can either unlock the drive, copy all data to an external drive, reformat the encrypted drive and copy all your data back (I think this is what you mean by backup) or have your system enter your password at boot for you per this answer.

  1. Add this at the end of the relevant line in /etc/crypttab:

    ,keyscript=/root/lukspw
    
  2. Create the file /root/lukspw

    # nano /root/luspw
    
  3. with the content (replacing "password" with your actual password):

    #!/bin/sh 
    printf "password"
    
  4. And make it executable:

    # chmod +x /root/lukspw
    
  5. And update the initrd:

    # update-initramfs -u -k`uname -r`
    

Drive is still encrypted but now no password is needed