WSL icon indicating copy to clipboard operation
WSL copied to clipboard

--mount support for USB flash drives

Open HoFamilyMaker opened this issue 5 years ago • 93 comments

upgrade to build 20226 run this command wsl --mount receive the error 'The remote procedure call failed'

image

Originally posted by @HoFamilyMaker in https://github.com/microsoft/WSL/issues/6008#issuecomment-702081473

HoFamilyMaker avatar Oct 01 '20 12:10 HoFamilyMaker

Hi @HoFamilyMaker, Thanks for reporting this.

This issue has already been identified and will be fixed in an upcoming insider build.

Out of curiosity, what kind of disk are you trying to mount ?

OneBlue avatar Oct 01 '20 19:10 OneBlue

Is this related to being able to access a WSL folder of the form...

\wsl$\docker-desktop-data\mnt\wsl\docker-desktop-data\data

with "Attempt to access invalid address" (this has been my Quick Access list in Explorer so I now it WAS the right folder).

Curiously, if I drill down to this folder in Explorer I can see the folder but it is now empty.

I have been using this for months, to edit in VS.Code. As of today, though, that folder is empty and I can no longer access the WordPress plugin I have been developing, since I can't access from VS.Code.

Strangely, though, the web site that is supposedly running from their (localhost) remains available. I'm really confused so any help would be really appreciated.

markwill890 avatar Oct 01 '20 21:10 markwill890

Hi @HoFamilyMaker, Thanks for reporting this.

This issue has already been identified and will be fixed in an upcoming insider build.

Out of curiosity, what kind of disk are you trying to mount ?

Thanks

I found this https://docs.microsoft.com/en-us/windows/wsl/wsl2-mount-disk

Limitations USB flash drives are not supported at this time and will fail to attach to WSL 2. USB disks are supported though.

my disk is USB flash change to USB disks (SSD) run wsl --mount is OK

image

image

HoFamilyMaker avatar Oct 01 '20 22:10 HoFamilyMaker

@HoFamilyMaker can you please update to the latest Insider build and try again to see if your problem is resolved?

You'll want to be on preview build 20226 or higher.

Thanks

My windows 10 is latest Insider build 20226 image

I found this

Limitations USB flash drives are not supported at this time and will fail to attach to WSL 2. USB disks are supported though.

try wsl2 to mount USB flash receive the error 'The remote procedure call failed' mount extend USB disk is OK

HoFamilyMaker avatar Oct 01 '20 22:10 HoFamilyMaker

My apologies @HoFamilyMaker I realize that the fix is not yet in Insiders, but thank you for updating! As @OneBlue mentioned we have a fix incoming for this soon, we'll ping this thread when it's available in the latest Insider build.

craigloewen-msft avatar Oct 01 '20 22:10 craigloewen-msft

Need this so much!

Can't do wsl --mount \.\PhysicalDrive1 :(

Imperatorn avatar Oct 29 '20 13:10 Imperatorn

I too am affected by this issue. Would really like to manipulate my linux partitions without additional software like Paragon. native support would be excellent.

Guessing this goes for the following as well:

PS C:\Windows\System32> wmic diskdrive list brief
Caption                       DeviceID            Model                         Partitions  Size
INTEL SSDSC2BA400G4           \\.\PHYSICALDRIVE0  INTEL SSDSC2BA400G4           4           400085844480
SanDisk Ultra Fit USB Device  \\.\PHYSICALDRIVE1  SanDisk Ultra Fit USB Device  3           15373048320

PS C:\Windows\System32> wsl --mount \\.\PHYSICALDRIVE1 --bare
The system cannot find the drive specified.
PS C:\Windows\System32> wsl --mount \\.\PHYSICALDRIVE1 --partition 3
The system cannot find the drive specified.

I tried also with my SD card device, but that's definitely flash memory.

mengesb avatar Nov 26 '20 22:11 mengesb

Any update?

BakedCrossiant avatar Mar 03 '21 12:03 BakedCrossiant

Hey folks, wanting to add some clarity here since I realize that my last comment was not very clear. We added a fix for the 'remote procedure call failed' which was the immediate blocker for this in the root issue. However WSL --mount does not yet have support for USB flash drives formatted in Linux file formats. If you'd like to mount a flash drive in WSL you can do that if it's seen in Windows (in other words, if it's formatted in a file format that Windows understands like NTFS) using sudo mount -t drvfs f: /mnt/usbDrive if you have a USB flash drive as F: on windows. As of right now we do not have support for USB flash drives formatted in other file formats that Windows can't understand. In the future we'll be investigating adding support for flash drives to wsl --mount as a feature request for future iterations, but this is currently a backlog request.

craigloewen-msft avatar Mar 17 '21 22:03 craigloewen-msft

The reason I want wsl to work is so I can work on Raspberry pi drives from my Windows PC or laptop.

kb3mkd avatar Apr 08 '21 22:04 kb3mkd

I want this so I can dd

Imperatorn avatar Apr 25 '21 11:04 Imperatorn

It would be great to get more clarification on this if It now works or not. I am confused if it works or not.

Use case why we like this feature:

A bunch of us seem to want to get access to the Raspberry PI sdcards so we can manipulate them. Originally we wanted to use wsl2 (the development version but the person working on this failed o get it working). Thus we developed an alternative in for gitbash at https://github.com/cloudmesh/cloudmesh-pi-burn in the branch https://github.com/cloudmesh/cloudmesh-pi-burn/tree/windows This is so we can in the meanwhile access the boot partition in windows directly. For this we developed a Diskpart class and it works reasonably well (not everything is yet working. we have not done the write part yet). HOwever if we were to have this in wsl2 we could do something like https://cloudmesh.github.io/pi/tutorial/raspberry-burn/ directly in wsl2. Right now we use gitbash.

I think many of us using the Pi for education would really appreciate a clarification about the status of this. Thanks

laszewsk avatar Jun 07 '21 09:06 laszewsk

@laszewsk as of right now --mount does not support USB flash drives if they are formatted in a Linux file format. This issue is left open to track this request. Please see this comment for full details: https://github.com/microsoft/WSL/issues/6011#issuecomment-801486712

craigloewen-msft avatar Jun 10 '21 17:06 craigloewen-msft

Can someone tell me how to do this please? I need to fsck my raspi card

Bluscream avatar Jan 05 '22 21:01 Bluscream

you could do a boot from a live linux CD and then use fsck from that.

In case you like to burn multiple SD Cards for a PI cluster, we updated our documentation at

  • https://piplanet.org
  • https://cloudmesh.github.io/pi/tutorial/

laszewsk avatar Jan 05 '22 22:01 laszewsk

you could do a boot from a live linux CD and then use fsck from that.

In case you like to burn multiple SD Cards for a PI cluster, we updated our documentation at

  • https://piplanet.org
  • https://cloudmesh.github.io/pi/tutorial/

Thanks, i've tried that but it was unable to fix my card through Parted and commandline

Bluscream avatar Jan 06 '22 06:01 Bluscream

+1, this feature is critical for anyone doing embedded development (and relies on transfers from SD cards via USB adapter).

blockfeed avatar Mar 28 '22 20:03 blockfeed

Same thing here, when using an sd card with adapter.

+1, this feature is critical for anyone doing embedded development (and relies on transfers from SD cards via USB adapter).

luizoti avatar Apr 03 '22 16:04 luizoti

Workaround is use Usb Reader (notebook integrated not allways works) + VMWare with Debian and GParted You can install VMWare Player, becase it now works with WLS2, but without hardware accelleration

AlexeiScherbakov avatar May 31 '22 10:05 AlexeiScherbakov

Same here, not working using USB reader


DeviceID           Caption                          Partitions Size          Model
--------           -------                          ---------- ----          -----
\\.\PHYSICALDRIVE0 Samsung SSD 970 EVO Plus 1TB     3          1000202273280 Samsung SSD 970 EVO Plus 1TB
\\.\PHYSICALDRIVE2 Lexar SD  WorkflowUR2 USB Device 2          15924142080   Lexar SD  WorkflowUR2 USB Device
\\.\PHYSICALDRIVE3 Lexar SD  WorkflowUR2 USB Device 0                        Lexar SD  WorkflowUR2 USB Device
\\.\PHYSICALDRIVE1 Lexar SD  WorkflowUR2 USB Device 0                        Lexar SD  WorkflowUR2 USB Device

PS C:\Users\Eugene> wsl --mount \\.\PHYSICALDRIVE2
The system cannot find the drive specified.

laptop buildin sd card slot not working too

PS C:\Users\Eugene> wmic diskdrive list brief
Caption                       DeviceID            Model                         Partitions  Size
Samsung SSD 970 EVO Plus 1TB  \\.\PHYSICALDRIVE0  Samsung SSD 970 EVO Plus 1TB  3           1000202273280
PciE SDHC-Card                \\.\PHYSICALDRIVE1  PciE SDHC-Card                2           15924142080

PS C:\Users\Eugene> wsl --mount \\.\PHYSICALDRIVE1
The system cannot find the drive specified.

Eugene-Lam avatar Jun 02 '22 09:06 Eugene-Lam

+1 on the desire to interact with my Pi SD card from windows

josh-hetland avatar Jun 05 '22 17:06 josh-hetland

We just released a new version of cloudmesh-pi-burn: https://cloudmesh.github.io/pi/tutorial/raspberry-burn-windows/ Although we use it for clusters, it can be used to burn a single card. However, the full potential is provided when you burn a cluster directly on the SD Cards, plug them in, switch the pis on and you have a readily configured cluster in your network. It does not burn in WSL2, BUT it burns on Windows, macOS, and Ubuntu. We use this regularly. Just in case you need a SLURM cluster, we just added documentation on how to do that here https://github.com/cloudmesh/cloudmesh-slurm#readme. We welcome contributions and improvements. We have used this code over the last 2 years and improved upon so it works now with the 64 bit OS.

laszewsk avatar Jun 05 '22 17:06 laszewsk

Also expressing desire to include flash support via USB to mount in WSL!

uberDoward avatar Jul 03 '22 19:07 uberDoward

This ideally needs to be supported.. but if not then the documentation here: on microsoft.com needs updating to make it clearer this doesn't work for USB drives, it reads like you can connect a usb drive to linux as a drive using the link, or you can mount it like you can a HDD using powershell, which this issue makes clear you cannot.

sambartle avatar Jul 08 '22 14:07 sambartle

It sounds like this is a limitation of Hyper-V as USB Passthrough does not work on removable USB devices as well (I was going to try this on an Ubuntu VM as a workaround).

I tried to install XRDP so I could use Enhanced Session for my Ubuntu VM as it sounded like that could get me USB passthrough through RDP, but it seems like the protocol version XRDP{ uses is too old.

One workaround is that ViruaulBox can do USB passthrough with removable USB drives, so running a Linux VM you can mount and use the drive from there, using VirtualBox Guest Services to access host drives if needed to transfer data both ways. The main problem is VirtualBox tends to have a lot of problems when Hyper-V or the Hypervisor is enabled (which is is by default on Windows Professional), making it very annoying if you regularly make use of Hyper-V backed features such as WSL or WSA. But it can be used if you don't mind disabling ALL Hyper-V features in Windows Features, the hypervisor using bcdedit, and rebooting, and turning them back on and rebooting again when you need them.

The-MAZZTer avatar Jul 08 '22 22:07 The-MAZZTer

Same here, not working using USB reader

DeviceID           Caption                          Partitions Size          Model
--------           -------                          ---------- ----          -----
\\.\PHYSICALDRIVE0 Samsung SSD 970 EVO Plus 1TB     3          1000202273280 Samsung SSD 970 EVO Plus 1TB
\\.\PHYSICALDRIVE2 Lexar SD  WorkflowUR2 USB Device 2          15924142080   Lexar SD  WorkflowUR2 USB Device
\\.\PHYSICALDRIVE3 Lexar SD  WorkflowUR2 USB Device 0                        Lexar SD  WorkflowUR2 USB Device
\\.\PHYSICALDRIVE1 Lexar SD  WorkflowUR2 USB Device 0                        Lexar SD  WorkflowUR2 USB Device

PS C:\Users\Eugene> wsl --mount \\.\PHYSICALDRIVE2
The system cannot find the drive specified.

laptop buildin sd card slot not working too

PS C:\Users\Eugene> wmic diskdrive list brief
Caption                       DeviceID            Model                         Partitions  Size
Samsung SSD 970 EVO Plus 1TB  \\.\PHYSICALDRIVE0  Samsung SSD 970 EVO Plus 1TB  3           1000202273280
PciE SDHC-Card                \\.\PHYSICALDRIVE1  PciE SDHC-Card                2           15924142080

PS C:\Users\Eugene> wsl --mount \\.\PHYSICALDRIVE1
The system cannot find the drive specified.

same problem here

yuhcaesar avatar Jul 11 '22 04:07 yuhcaesar

Same problem here as well. Unable to read the USB SD reader.

DeviceID            Caption                      Partitions Size           Model
--------            -------                      ---------- ----           -----
\\.\PHYSICALDRIVE10 NORELSYS 1081 USB Device     1          1023866403840  NORELSYS 1081 USB Device

> wsl --mount "\\.\PHYSICALDRIVE10"
The system cannot find the drive specified.

> wsl --mount "\\.\PHYSICALDRIVE10" --bare
The system cannot find the drive specified.

> wsl --mount "\\.\PHYSICALDRIVE10" --partition 1
The system cannot find the drive specified.

r12f avatar Jul 14 '22 19:07 r12f

I found this third party tool which allows you to mount USB devices in WSL:

https://github.com/dorssel/usbipd-win

I was able to get my SD card reader to show up in lsusb, however I could not get any devices to show up in /dev/ for the drive/partitions themselves on my microSD card. But from some of the things I'm reading on there it sounds like some devices do mount properly. So this may work for some devices.

The-MAZZTer avatar Jul 25 '22 15:07 The-MAZZTer

+1 it will be very much appreciated if MSFT adds the support for USB flash drives. I too need to manipulate my raspberry pi SD card from Windows. @microsoft please help

akash07k avatar Aug 14 '22 21:08 akash07k

now nothing is mentioned in the limitations section on the docs page about USB drives. still the issue persists

akash07k avatar Aug 14 '22 21:08 akash07k