Re: Restored luks2 header to wrong drive!

Milan Broz <[email protected]>
Newsgroups gmane.linux.kernel.device-mapper.dm-crypt
Message-ID <[email protected]>
On 05/05/2020 15:39, Default User wrote:
> 
> Just a note: maybe LUKS could someday add a feature that would check
> before restoring a luks2 header, and alert the user that they are
> trying to restore to a different disk than the header was backed up
> from, or to a disk that does not appear to contain LUKS encrypted
> data.

A generic warning is there:

# cryptsetup luksHeaderRestore /dev/sdb --header-backup-file /luks-bck.img

WARNING!
========
Device /dev/sdb does not contain LUKS2 header. Replacing header can destroy data on that device.

...

Just is should say what filesystem is there (we do this check on luksFormat already):
through libblkid:

# cryptsetup luksFormat /dev/sdb
WARNING: Device /dev/sdb already contains a 'ext4' superblock signature.
...

so it is really just trivial fix.

Milan
_______________________________________________
dm-crypt mailing list
[email protected]
https://www.saout.de/mailman/listinfo/dm-crypt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.