3

How do I format LUKS encrypted disk if I don't know the passphrase?

I recently switched my HDD for a new SSD disk in my laptop and now when I connect the old HDD externally I can't mount disk event with the right passphrase (I assume I am doing something wrong at this point). However I want to format that disk and use it as regular external HDD, so is there a way how to do that? All tutorials I've found requires the knowledge of passphrase.

This is what I get during unlocking

Error unlocking /dev/dm-6: Command-line `cryptsetup luksOpen "/dev/dm-6" 
"luks-5a73e3e1-6b40-415f-8c40-ca14faecc7cb" ' 
exited with non-zero exit status 1: .
  • Please elaborate more... Since you're trying to unlock /dev/dm-6, do you have LVM on there too? Do you want LVM on an external HDD? – frostschutz Oct 26 '14 at 22:33
4

If you want to overwrite the data of the encrypted disk with non-encrypted data anyway (i.e. you don't care about the current contents), you don't have to unlock the drive/partition first.

If the partition has a particular uncommon partition type, you might want to change that, but it is not necessary. You can just use mkfs.ext4 (or any filesystem type you prefer) on the partition which contains the LUKS encrypte partition.

  • Is there a way to make it seem as if the drive was never encrypted? Is it just overwriting the partition that LUKS was setup on? In that case I could just zero out the partition right? – CMCDragonkai Nov 18 '15 at 8:45
  • @CMCDragonkai I don't think that the header information for a LUKS partition (with the password encryptions of the decoding key) is repeated on the drive. So if you just zero the first blocks the rest should look like random garbage. But as random data might indicate (irretrivable) prior encryption, to be sure you could just zero the whole partition. – Anthon Nov 18 '15 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.