Files
gists/mount-luks-drive-to-windwos-subsystem-for-linux-bare.md
2026-09-24 07:20:48 -05:00

1.6 KiB

Mount LUKS drive to Windows Subsystem for Linux Bare

To mount a LUKS encrypted drive using WSL 2 with the --bare flag, you must run PowerShell as an administrator, identify the physical drive, and attach it to WSL before unlocking it within the Linux environment.

1. Identify and Mount the Drive in PowerShell First, list connected disks to find the correct DeviceID (e.g., \\.\PHYSICALDRIVE1):

Get-CimInstance -query "SELECT * from Win32_DiskDrive"

Then, mount the entire disk to WSL without automatically mounting the filesystem:

wsl --mount \\.\PHYSICALDRIVE1 --bare

2. Decrypt and Mount in WSL Open your WSL distribution (e.g., Ubuntu) and install cryptsetup if not present:

sudo apt install cryptsetup

Identify the partition using lsblk or dmesg, then unlock the LUKS volume:

sudo cryptsetup luksOpen /dev/sdX1 my-encrypted-disk

Finally, mount the decrypted mapper device to a directory:

sudo mkdir -p /mnt/luks-drive
sudo mount /dev/mapper/my-encrypted-disk /mnt/luks-drive

The files are now accessible via Windows Explorer at \\wsl$\<DistroName>\mnt\luks-drive.

Important Constraints:

  • Administrator Privileges: The wsl --mount command requires elevated PowerShell rights.
  • Disk Availability: You can only mount offline or external disks. If the LUKS partition is on the same physical disk as Windows (e.g., the C: drive), you cannot detach it from Windows to mount it in WSL.
  • WSL 2 Required: This feature is only supported in WSL 2 on Windows 10 (Build 20211+) or Windows 11.