How to Mount USB Drives in WSL
If you use the Windows Subsystem for Linux (WSL) environment, you might want to use your drives-in-windows-11/" class="sal-link" rel="noopener" target="_blank" data-sal-id="11166">USB drives inside your Linux environment. Windows 11 handles your internal drives automatically, but external drives need a little extra help. It is important to know that there are two ways to do this: using the wsl --mount command for storage drives or using usbipd-win for USB devices like webcams or specialized hardware.
Why mount a USB in WSL?
Mounting your drive lets you move files between your Windows folders and your Linux apps. It makes working on projects much faster. You can access raw disk data or specific USB hardware directly within your Linux distribution.
What happens when done?
Once you finish these steps, your USB drive will show up as a folder inside your Linux environment. You can then read or write files to that drive just like any other folder. If you use USBIPD, the device will appear as if it is plugged directly into a physical Linux machine.
Understanding WSL 2 Disk Mounting vs. USBIPD
It is critical to distinguish between these two methods. The wsl --mount command is for physical disk storage, such as USB thumb drives or external hard drives formatted with NTFS, FAT32, or ext4. The usbipd-win tool is for USB passthrough, which allows Linux to talk to non-storage USB devices like serial adapters, security keys, or cameras.
Method 1: Mounting Storage Drives with wsl –mount
Note: You will need to run these commands in PowerShell with administrative privileges.
- Open PowerShell as Administrator.
- Identify your disk path by running:
wsl --list --disk - Mount the disk using the path found (e.g., \\.\PHYSICALDRIVE1):
wsl --mount \\.\PHYSICALDRIVE1 --partition 1
Method 2: Using USBIPD for USB Passthrough
For non-storage devices, you must use the official Microsoft USBIPD GitHub repository. This requires installing the software on Windows and the usbip tools inside your Linux distribution.
- Install the usbipd-win installer on Windows.
- In PowerShell, list devices:
usbipd list - Bind the device:
usbipd bind --busid 1-1(Requires Admin) - Attach to WSL:
usbipd attach --wsl --busid 1-1
Troubleshooting and Permissions
If your drive does not appear, ensure you are running Windows 11 build 22000 or higher. Always check that your user account has permission to access the mount point. If you receive a permission error, try using sudo before your mount commands.
Can I mount a USB drive in WSL 1?
No, the wsl --mount feature is exclusive to WSL 2. WSL 1 does not support physical disk mounting or USB passthrough because it does not use a real Linux kernel. You must upgrade your distribution to WSL 2 to use these advanced hardware features.
Why does my USB drive show up in Windows but not in WSL?
WSL does not automatically mount external drives to prevent conflicts with Windows. You must manually attach the disk using the wsl --mount command or the usbipd utility. If the drive is currently in use by Windows, you may need to eject it from Windows first.
How do I safely detach a USB drive from WSL?
To safely remove a drive, first unmount it inside Linux using sudo umount /mnt/f. Then, run wsl --unmount \\.\PHYSICALDRIVE1 in PowerShell. If you used USBIPD, run usbipd detach --busid 1-1 in PowerShell to release the device back to Windows control.
Summary
- Use
wsl --mountfor storage drives like USB sticks. - Use
usbipd-winfor non-storage USB devices like cameras. - Always unmount or detach devices before physically unplugging them to prevent data corruption.
- WSL 2 is required for all hardware passthrough features.
Was this guide helpful?
Leave a Reply Cancel reply