Skip to content

Instantly share code, notes, and snippets.

@torum
Last active May 6, 2025 02:00
Show Gist options
  • Select an option

  • Save torum/6d24536486745d3350ea665a22130074 to your computer and use it in GitHub Desktop.

Select an option

Save torum/6d24536486745d3350ea665a22130074 to your computer and use it in GitHub Desktop.
Mount external Luks encrypted drives in Windows WSL2

https://learn.microsoft.com/ja-jp/windows/wsl/wsl2-mount-disk

https://gist.github.com/gtirloni/5b62ad835a06da21a6bd11aa78d3f7c4

(1) List your disks:

> GET-CimInstance -query "SELECT * from Win32_DiskDrive"

(2) Mount the whole disk(Use sudo or as admin):

> sudo wsl --mount \\.\PHYSICALDRIVE1 --bare

(3) In WSL2, Check the device name of the mounted disk (something like /dev/sd*):

$ lsblk

(4) Open the LUKS drive:

$ sudo cryptsetup luksOpen /dev/sdc myLuksDisk

(5) Create /mnt/wsl/MyExtDisk dir and mount it:

$ mkdir /mnt/wsl/MyExtDisk
$ sudo mount /dev/mapper/myLuksDisk /mnt/wsl/MyExtDisk

Access it using Explorer.

\\wsl.localhost\Ubuntu-24.04\mnt\wsl\MyExtDisk

Finishing up.

$ sudo umount /mnt/wsl/MyExtDisk
> wsl --unmount \\.\PHYSICALDRIVE1

NOTE the directory under /mnt/wsl/ will be cleared after the reboot, so you'd need to create the directory each time... I'd like to know if there is a better way to do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment