Skip to content

How to attach a veracrypt encrypted USB drive to WSL

Requirements

Install veracrypt-console on WSL

# Ubuntu 22.04
wget https://launchpad.net/veracrypt/trunk/1.25.9/+download/veracrypt-console-1.25.9-Ubuntu-22.04-amd64.deb
sudo apt install libfuse2
sudo dpkg -i veracrypt-console-1.25.9-Ubuntu-22.04-amd64.deb

# Ubuntu 20.04
wget https://launchpad.net/veracrypt/trunk/1.25.9/+download/veracrypt-console-1.25.9-Ubuntu-20.04-amd64.deb
sudo dpkg -i veracrypt-console-1.25.9-Ubuntu-20.04-amd64.deb

On Windows in PowerShell:

Find USB drive path:

GET-CimInstance -query "SELECT * from Win32_DiskDrive"

Example output:

DeviceID           Caption                        Partitions Size          Model
--------           -------                        ---------- ----          -----
\\.\PHYSICALDRIVE2 WD My Passport 2626 USB Device 0          5000945564160 WD My Passport 2626 USB Device
\\.\PHYSICALDRIVE1 SAMSUNG MZVPV512HDGL-00000     2          512105932800  SAMSUNG MZVPV512HDGL-00000
\\.\PHYSICALDRIVE0 SAMSUNG MZVL21T0HCLR-00B00     4          1024203640320 SAMSUNG MZVL21T0HCLR-00B00

Can see here that the USB drive DeviceID is \\.\PHYSICALDRIVE2

Mount

As administrator in PowerShell:

wsl --mount \\.\PHYSICALDRIVE2 --bare

On WSL (Ubuntu):

Find the drive

sudo lsblk

Example output:

NAME MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda    8:0    0 363.1M  1 disk
sdb    8:16   0    16G  0 disk [SWAP]
sdc    8:32   0     1T  0 disk /mnt/wslg/distro
                               /
sdd    8:48   0   4.5T  0 disk

Mount the drive /dev/sdd to the mountpoint /mnt/a

sudo veracrypt -m=nokernelcrypto /dev/sdd /mnt/a

Respond to the prompts if they come up:

Enter password for /dev/sdg: [Your password]
Enter PIM for /dev/sdg: [ENTER]
Enter keyfile [none]: [ENTER]
Protect hidden volume (if any)? (y=Yes/n=No) [No]: [ENTER]
Published inDevelopment

Be First to Comment

Leave a Reply