Formatting LUKS encrypted disk

5,952

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.

Share:
5,952

Related videos on Youtube

Petr Mensik
Author by

Petr Mensik

I mostly do Java and Java EE stuff although I am currently also interested in security and big data. SOreadytohelp

Updated on September 18, 2022

Comments

  • Petr Mensik
    Petr Mensik over 1 year

    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: .
    
    • Admin
      Admin over 9 years
      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?
  • CMCDragonkai
    CMCDragonkai over 8 years
    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?
  • Anthon
    Anthon over 8 years
    @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.