Partition still encrypted with luks after wipefs

encryptionlukspartition

I wiped the disk using

wipefs -a /dev/sda.

I happily formatted the disk, and it seems that when I'm about to mount /dev/sda3 it says "unknown file system type crypto_LUKS".

I did no encryption on this partition, so it's like the previous configuration is saved somehow.
If I apparently wiped or reset the disk, how can this be possible?

Do I have to open and decrypt and remove encryption on that drive first?

Best Answer

wipefs -a /dev/sdx only wipes magic signatures on that device, not on its partitions. So at best, it only wipes your partition table, but if you then proceed to re-create the partitions at the same offsets at before, the old data is still there. You'd have to wipe the partitions as well.

wipefs -a /dev/sdx[1-9]* # wipe old partitions
wipefs -a /dev/sdx       # wipe the disk itself
parted /dev/sdx          # create new partitions
wipefs -a /dev/sdx[1-9]* # wipe the new partitions, just in case
# create filesystems or whatever

That aside it's also entirely possible for wipefs to not wipe something if it doesn't know the signature. Or for another program to still recognize the data on the partition despite the signature being damaged. wipefs only overwrites a few magic bytes, which is reversible in most cases.

Related Question