Re: Restored luks2 header to wrong drive!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 4, 2020 at 9:10 PM Default User <hunguponcontent@xxxxxxxxx> wrote:
>
> Hi.
>
> I am sure you have heard this before.
>
> I have a computer running Debian unstable, Cinnamon desktop environment.  I have a testing usb thumb drive, labeled USBSDOO3,  which I formatted ext4, and encrypted with luks1, using the Gnome "disks" utility program.
>
> I then installed cryptsetup and used its "convert" option to change USBSD003 from luks1 to luks2.
>
> Then I used the cryptsetup header backup function to backup the luks2 header to my internal ssd drive. All good so far.
>
> Then, as a test, I tried to restore the luks2 header to USBSD003.
>
> Well, I made a HUGE mistake!
> USBSD003 was plugged in as device /dev/sdc1.
>
> But . . .
> I entered the command:
>
> Sudo cryptsetup luksHeaderRestore /dev/sdb1
> --header-backup-file \
> LUKS_header_backups/USBSD003_luks_header_backup_2020-05-04.
>
> Unfortunately, at /dev/sdb1 was a 1Tb usb external hard drive, one partition only, formatted ext4, UNENCRYPTED, labeled USBHD005. So I endeded up restoring the header to the hard drive, instead of to the thumb drive!

So the first step is, don't panic. And don't try to fix it. The more
writes you make without a plan, the greater the chance of permanent
data loss.

If you can, make a block copy of the drive so you can safely test
repairs. All repair attempts come with risk of making the problem
worse. If you can't make a copy of the drive, at least check this out:
https://raid.wiki.kernel.org/index.php/Recovering_a_failed_software_RAID#Making_the_harddisks_read-only_using_an_overlay_file

And it could even be useful if you do make a block copy, because then
you can iterate repair attempts before committing.

You might have to estimate what the offset was, if this drive was
partitioned, and whether the mistaken luks header restore stomped on
just the partition map. New partition tools create the first partition
at LBA 2048 (1MiB offset). If it's GPT, the backup may still be intact
and restorable. And speaking of old tools, grab a recent Live image of
Fedora or Arch, when you get down to recovery you want the latest
tools.

Anyway, since it's ext4, I'd search the ext4 list archives for prior
advice. And then once you have an initial strategy you can post it and
ask for a sanity check. Google finds a lot of ancient advice. It might
be valid.

-- 
Chris Murphy
_______________________________________________
dm-crypt mailing list
dm-crypt@xxxxxxxx
https://www.saout.de/mailman/listinfo/dm-crypt



[Index of Archives]     [Device Mapper Devel]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux