If you’re a user of the Windows Subsystem for Linux (WSL), you might have noticed that when you plug in a USB flash drive, it doesn’t automatically appear in your Linux environment. Unlike your C: drive, which is typically mounted at /mnt/c, WSL does not automatically mount removable drives.

Fortunately, accessing your USB drive from within WSL is a straightforward process. This guide will walk you through the two primary methods for mounting a USB drive in WSL2, from a simple drive letter mount to accessing the raw physical disk.


Understanding the Challenge: Why USB Drives Don’t Auto-Mount

WSL is designed to be a lightweight and isolated environment. For security and stability reasons, it does not automatically mount every device that is connected to your Windows host. This means you have to manually tell WSL to mount the drive.

Prerequisite: WSL2 is Recommended The methods described below work best with WSL2, which has a full Linux kernel and better support for hardware access. If you are still on WSL1, you should consider upgrading (wsl --set-version <DistroName> 2).


Method 1: The Easy Way (Mounting a Windows Drive Letter)

This is the simplest and most common method for accessing the files on a USB drive. It works by mounting the drive letter that Windows has assigned to the USB (e.g., E:).

Step 1: Identify the USB Drive Letter in Windows

First, plug in your USB drive and note the drive letter that Windows assigns to it in File Explorer (e.g., E:).

Step 2: Mount the Drive in WSL

  1. Open your WSL terminal (e.g., Ubuntu).
  2. Create a mount point. This is simply a directory where the contents of the USB will be accessible.
    sudo mkdir /mnt/e
  3. Use the mount command to attach the Windows drive to the mount point.
    sudo mount -t drvfs E: /mnt/e

Command Explanation:

  • sudo mount: The standard Linux command to mount a filesystem.
  • -t drvfs: Specifies the filesystem type as drvfs (Drive File System), which is the protocol WSL uses to communicate with the Windows filesystem.
  • E:: The Windows drive letter you want to mount.
  • /mnt/e: The destination directory (mount point) inside WSL.

Step 3: Access Your Files

You can now access the files on your USB drive by navigating to the mount point.

ls /mnt/e
cd /mnt/e


Method 2: The Advanced Way (Mounting a Raw Physical Disk)

For more advanced use cases, such as using Linux tools like dd, fdisk, or gparted, you may need to access the raw physical disk instead of just the formatted volume. The wsl --mount command allows you to do this.

Step 1: Identify the USB Disk in Windows

Open PowerShell as an Administrator and list all physical disks to find the disk number of your USB drive.

Get-Disk

Example Output:

Number Friendly Name  OperationalStatus Total Size Partition Style
------ -------------  ----------------- ---------- ---------------
0      NVMe SSD       Online            512 GB     GPT
1      USB DISK 3.0   Online            16 GB      MBR
In this example, the USB drive is Disk 1, which corresponds to the path \.\PHYSICALDRIVE1.

Step 2: Mount the Physical Disk into WSL

In the same administrative PowerShell terminal, use the wsl --mount command to attach the physical disk to WSL.

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

The --bare flag attaches the physical disk without attempting to mount its filesystems.

Step 3: Identify and Mount the Partition in WSL

  1. Now, switch to your WSL terminal and list the block devices.
    lsblk
    You should now see a new device, such as /dev/sdb, with its partitions (e.g., /dev/sdb1).
  2. Create a mount point and mount the partition.
    sudo mkdir /mnt/usb
    sudo mount /dev/sdb1 /mnt/usb

You can now access the files at /mnt/usb and use tools like fdisk /dev/sdb to interact with the raw disk.


How to Safely Unmount a USB Drive

Before you physically unplug your USB drive, you must unmount it to prevent data corruption.

For Method 1 (Drive Letter Mount):

sudo umount /mnt/e

For Method 2 (Physical Disk Mount):

  1. Unmount the partition inside WSL:
    sudo umount /mnt/usb
  2. Detach the physical disk from WSL in your PowerShell terminal:
    wsl --unmount \\.\PHYSICALDRIVE1

Troubleshooting Common Issues

Issue Cause Fix
USB not showing in /mnt/ It’s not mounted yet. Use sudo mount -t drvfs E: /mnt/e.
wsl --mount gives an error You are not running PowerShell as an Administrator. Close and reopen PowerShell as an Administrator.
Cannot write to the USB The filesystem was mounted as read-only. For drvfs, you can try adding the -o metadata option to the mount command to better handle permissions.
WSL1 doesn’t show disks This is a limitation of WSL1. Upgrade your distribution to WSL2 with wsl --set-version <DistroName> 2.

Conclusion

Accessing USB drives in WSL2 is a simple process once you know the correct commands.

  • For quick and easy file access, mounting the Windows drive letter is the best approach.
  • For advanced tasks that require raw disk access, the wsl --mount command provides the power you need.

By following these steps, you can seamlessly integrate your USB storage into your WSL workflow, giving you the best of both the Windows and Linux worlds.