Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--mount support for USB flash drive #9290

Open
byte-me-stan opened this issue Dec 9, 2022 · 17 comments
Open

--mount support for USB flash drive #9290

byte-me-stan opened this issue Dec 9, 2022 · 17 comments
Labels

Comments

@byte-me-stan
Copy link

byte-me-stan commented Dec 9, 2022

Is your feature request related to a problem? Please describe.
Not able to mount USB flash drive in wsl. It fails to attach to WSL 2. Same issue for NTFS, FAT and exFAT.

Describe the solution you'd like
USB flash drive should be able to mount using wsl --mount command and allow to access from /dev/sdb

Describe alternatives you've considered
NA

Additional context
image

Windows 11 Home
Version 22H2 OS build 22621.819

@xiao-k233
Copy link

I have this problem too!
image

@zweistein22
Copy link

same error here.

Probably related to #8885 and
#9283

@zweistein22
Copy link

here is a solution: well done
https://github.com/jovton/USB-Storage-on-WSL2

@byte-me-stan
Copy link
Author

byte-me-stan commented Dec 15, 2022

@zweistein22 kindly ignore my previous question. I found the answer. It doens't have an extension at all.

Cheers mate !

@andrsmllr
Copy link

Same here.
Mounting a USB drive to WSL works with an external USB drive (ext4 FS), but does not work with an external USB flash drive (exFAT FS).
Will try the workaround (use iSCSI to connect drive from Windows to WSL) mentioned above. It's not a solution imho.

@williamjshipman
Copy link

Mounting the root partition from a Raspberry Pi (connected via USB after running rpiboot) does not work. I get the same error code as above, even though this is an ext4 partition.

@alpinemobile
Copy link

I'm getting the same behavior that andrsmllr mentioned.
Fix this please. Thanks

@xiao-k233
Copy link

i think we can solve it
use usbipd

@rhubear25
Copy link

i think we can solve it use usbipd

According to thread (actually referenced above) ....
https://github.com/jovton/USB-Storage-on-WSL2
.... USB/IP not yet supported on WSL2 bc of existing WSL2 limitations.

The solution in said thread is to use iSCSI emulation to get around limitations of both WSL2 & USB/IP.

@ayan4m1
Copy link

ayan4m1 commented Mar 26, 2024

Same issue. Extremely disappointing. 😭 I needed a win today, but no.

@4nu81
Copy link

4nu81 commented Mar 28, 2024

Same issue.
Using iscsi is not a solution. It's a try to get away with bad design.
Very disappointing.

@pawelzwronek
Copy link

As a workaround I cloned whole sd card to a file and mounted it with sudo losetup -fP --show /mnt/d/backup/rpi5.raw
Then mount ext4 partition:

lsblk /dev/loop0
sudo mount /dev/loop0p2 /home/p/rpi_backup/ext4_mount

@jeremy-ekers
Copy link

I am getting this error with a microSD card.

C:\Users\jeremy>wmic diskdrive list brief
Caption DeviceID Model Partitions Size
asmedia ASM------ SCSI Disk Device \.\PHYSICALDRIVE1 asmedia ASM----- SCSI Disk Device 1 -------------
SDHC Card \.\PHYSICALDRIVE2 SDHC Card 2 15924142080
NVMe PC SN810 NVMe WDC 512GB \.\PHYSICALDRIVE0 NVMe PC SN810 NVMe WDC 512GB 4 512105932800

C:\Users\jeremy>wsl --mount \.\PHYSICALDRIVE2 --partition 2
The system cannot find the drive specified.
Error code: Wsl/Service/AttachDisk/HCS/0x8007000f

@JFLarvoire
Copy link

JFLarvoire commented Mar 16, 2025

I am getting this error with a microSD card.

Same problem for me, trying to access a micro SD card extracted from a Raspberry Pi.

I noticed that this SD card has 2 partitions, one of which is formatted as FAT32, and automatically mounted by Windows.
Which may explain why the disk is locked, and cannot be assigned to the WSL2 subsystem?
(I was interrested by the other partition, formatted as EXT4, with the Raspberry OS contents.)
The surprising thing though is that if I eject that FAT32 partition from Windows (Right clicking on it in File Explorer, then clicking on Eject), then the .\PHYSICALDRIVE1 device also disappears from Windows!?!
I have to physically eject the SD card, then plug it back in, to make that device reappear. But the FAT32 partition also remounts, in a catch 22 situation. :-(

@dopemike
Copy link

Same problem for me, trying to access a micro SD card extracted from a Raspberry Pi.

Same here... kind of disappointing

@rhubear25
Copy link

I've long ago stopped using WSL2 altogether.
I was reminded of the EARLY days of the Linux kernel.... Not again tnx.

I switched to using a VM of a "proper" Linux distro.... Works hella better....

@ivucica
Copy link

ivucica commented Mar 25, 2025

I've long ago stopped using WSL2 altogether.
I was reminded of the EARLY days of the Linux kernel.... Not again tnx.

I switched to using a VM of a "proper" Linux distro.... Works hella better....

Unfortunately, this turned out to not be so easy after I tried to do the same for one particular use case: ROCm (AMD's counterpart to Nvidia's CUDA-and-friends). For this use case, it doesn't work at all.

Details

/dev/dxg is exposed on WSL2 under Windows 10, but it requires a custom kernel patch. Microsoft's WSL2 kernel is not quite packaged for Debian; the kernel that's on Windows 10 22H2 is a patched up 5.10.x, and it looks like the latest branch on GitHub is from 6.6.x series. The dxgkrnl module is not officially packaged or maintained into something usable with DKMS. (Neither third-party-packaged WSL2 kernel nor third-party-packaged dxgkrnl worked -- but installing those is a workaround anyway.)

For this particular use case (ROCm via /dev/dxg), it seems like running a VM is more tedious than is worth.

Then again, I am not sure what the performance would be even if I got it to work in a VM: when I gave up on that, and simply fell back to using WSL2, with mounting my physical install and chrooting into it, it took so long to load the module that I didn't even wait for it to load from my NVME. Usually loading a model takes seconds on this same machine under native Linux.

This is without even going into what this particular bug #9290 is really about -- mounting ARBITRARY block devices (USB drives, although actually doing it with individual partitions would be even nicer) for purposes of operations such as fixing an install of Raspberry Pi's OS or another Linux install on an external drive.

What I finally fell back to is -- simply booting my native install and rolling back the install of the WSL-enabled ROCm PyTorch into just native ROCm PyTorch. It would be nice to be able to switch to Linux without reboot, but alas, it seems it is not meant to be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests