I apologise if this is already common knowledge, but I just found out you can have multiple layers of LUKS encryption on a drive!
[Image description:
Screenshot of terminal output:
<span style="color:#323232;">~ ❯ lsblk
</span><span style="color:#323232;">NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
</span><span style="color:#323232;">sda 8:0 1 62.5M 0 disk
</span><span style="color:#323232;">└─topLuks 254:2 0 60.5M 0 crypt
</span><span style="color:#323232;"> └─bottomLuks 254:3 0 44.5M 0 crypt
</span>
/end image description]
I had no idea!
If anyone else is curious, it’s pretty much what you would expect:
<span style="color:#323232;">cryptsetup -y -v luksFormat /dev/sda
</span><span style="color:#323232;">cryptsetup open /dev/sda topLuks
</span><span style="color:#323232;">cryptsetup -y -v luksFormat /dev/mapper/topLuks
</span><span style="color:#323232;">cryptsetup open /dev/mapper/topLuks bottomLuks
</span><span style="color:#323232;">lsblk
</span>
Then you can make a filesystem and mount it:
<span style="color:#323232;">mkfs.ext4 /dev/mapper/bottomLuks
</span><span style="color:#323232;">mount /dev/mapper/bottomLuks ~/mnt/embeddedLuksTest
</span>
I’ve tested putting files on it and then unmounting & re-encrypting it, and the files are indeed still there upon decrypting and re-mounting.
Again, sorry if this is not news to anyone else, but I didn’t realise this was possible before, and thought it was very cool when I found it out. Sharing in case other people didn’t know and also find it cool :)
![](https://kbin.social/media/cache/resolve/entry_thumb/b9/f6/b9f610f490cfdb471bccd9ff5f7f98ac67b9a07463c67fdb97d919b17f11d6fd.png)
Add comment