If you have a LUKS-encrypted partition on another disk, it's easy to mount it inside WSL.
List your disks:
> wmic diskdrive list brief
Mount the whole disk inside WSL (using --bare
so WSL doesn't attempt to mount it automatically):
> wsl --mount \\.\PHYSICALDRIVE1 --bare
Now inside WSL, check the device name of the mounted disk (something like /dev/sd*
):
$ dmesg | tail
Open the LUKS device (it'll prompt for your passphrase):
$ sudo cryptsetup luksOpen /dev/sdd3 my-encrypted-disk
And mount it somewhere:
$ sudo mount /dev/mapper/my-encrypted-disk /somewhere
Avoid mounting on /mnt
because that's usually used by WSL itself to mount your C:
drive.
Hello,
I wanted to express my gratitude to you for sharing the information on how to mount a cryptsetup in WSL in the most simple way that I found online. Thanks to your guidance, I was able to effortlessly execute the "luksopen" command and mount my LVM partition, which uses the ext4 file system – just as I'm accustomed to doing. I've streamlined the process by directly running 'commands' in wsl.exe within a PowerShell script, and it even worked seamlessly with a GPG-encrypted keyfile.
I truly appreciate your help. Thank you very much! WSL going strong
Cipher used over here: twofish-xts-plain64 - works fine to decrypt drive even if the twofish module seems missed in in /proc/crypto in my wsl2 setup.