I had a USB drive encrypted with dmcrypt+LUKS which I forgot the password to.
I later formatted it but as soon as I formatted it I remembered the password.
Is there any way to recover/restore the partition or is it gone?
I had a USB drive encrypted with dmcrypt+LUKS which I forgot the password to.
I later formatted it but as soon as I formatted it I remembered the password.
Is there any way to recover/restore the partition or is it gone?
If you have:
luksHeaderBackup <device> --header-backup-file <file>
)--dump-master-key
the actual encryption key, no passphrase required)then it might be possible to recover some files, depending on how much was overwritten.
--header <device or file storing the LUKS header>
withopen
to open the container using the backup header and a passphrase.--master-key-file
withopen
to open the LUKS device without a passphrase.See
man cryptsetup
for more descriptions of the options & usage.Even if some areas were overwritten, it might be possible to repair/recover some files, either fixing the filesystem or doing an "undelete" type search, or a data carving tool to grab the remaining readable files.
testdisk
can go a long way towards those goals.