1

I have a large size SD card that was encrypted with LUKS using the GNOME Disk Utility running on Ubuntu. I had some cherished photos on it. I've managed to accidentally format the SD card and wish to know if there is some way to recover it.

I formatted it with the quick formatting option, meaning that the SD card was not overwritten with zeros.

I have the passcode that was used to decrypt the SD card. Asking ChatGPT for help suggested that a backup of something called the LUKS header would help. I did not make such a backup myself. However, the SD card was decrypted and mounted using a computer with Ubuntu and that computer has not been rebooted since then. The same computer was also the one to initially format the SD card with LUKS.

Is it possible that this computer has a backup of this LUKS header? Is there some other approach I could try. Feeling a bit heartbroken here and would very much appreciate more information or guidance.

(I'm aware that a backup should have existed. This was not possible due to a lack of funds.)

  • 6
    Is the crypt container still open and active on that machine? (dmsetup table --showkeys, cat /proc/partitions, ...) Otherwise it depends what was overwritten actually - see [cryptsetup repair](https://unix.stackexchange.com/a/741850/30851) – frostschutz May 21 '23 at 18:48
  • Thanks so much for your comment. The SD card is not still mounted (it is currently physically removed from the computer) and so I don't think the `dmsetup` output lists anything to do with the SD card. I have no idea what is actually overwritten by the GNOME Disk Utility when a drive is formatted using the quick option (where zeros are not written over the whole drive). – BlandCorporation May 21 '23 at 19:50
  • 1
    I'm sorry to say but it's gone. There's no backup unless you've done it: https://www.cyberciti.biz/security/how-to-backup-and-restore-luks-header-on-linux/ – ChanganAuto May 21 '23 at 22:00

0 Answers0