How to access mounted network drive on Windows Linux Subsystem?

from the link bleater posted

Mounting DrvFs

In order to mount a Windows drive using DrvFs, you can use the regular Linux mount command. For example, to mount a removable drive D: as /mnt/d directory, run the following commands:

$ sudo mkdir /mnt/d
$ sudo mount -t drvfs D: /mnt/d

Now, you will be able to access the files of your D: drive under /mnt/d. When you wish to unmount the drive, for example so you can safely remove it, run the following command:

$ sudo umount /mnt/d

Mounting network locations

When you wish to mount a network location, you can of course create a mapped network drive in Windows and mount that as indicated above. However, it's also possible to mount them directly using a UNC path:

$ sudo mkdir /mnt/share
$ sudo mount -t drvfs '\\server\share' /mnt/share

Note the single quotes around the UNC path; these are necessary to prevent the need to escape the backslashes. If you don't surround the UNC path with single quotes, you need to escape the backslashes by doubling them (e.g. \\\\server\\share).

WSL does not have any way to specify which credentials to use to connect to a network share. If you need to use different credentials to connect to the server, specify them in Windows by navigating to the share in File Explorer, using the Windows Credential Manager, or the net use command. The net use command can be invoked from inside WSL (using net.exe use) via interop. Type net.exe help use for more information on how to use this command.


[Update -- apparently this feature is available in build 16176. I haven't tried it yet.]

No, though there may be some trick I haven't discovered. Windows Subsystem for Linux does not mount network drives. A Microsoft employee says here (in a comment):

We only “mount” fixed drives at this time. USB/removable/network drives are not handled at this time. This capability is on our backlog, but it’s not on the cards anytime soon.

So don't hold your breath.

I attempted to work around it by using a symbolic link, like this:

c:> mklink /d c:\some\directory \\some_server\some_share

The link works just fine in "normal" Windows (cmd.exe, PowerShell, file explorer, etc.), but is invisible to WSL:

$ ls -ld /mnt/c/some/directory
/mnt/c/some/directory not found

For my own use, this limitation is a show-stopper. I have things on network drives that I'm not willing to move. There are alternatives; I'm using Cygwin.


WSL2 supports CIFS (SMB) protocol. You may need to specify your network server version when mounting. E.g. on Ubuntu 20.04:

$ sudo apt install cifs-utils
$ sudo mount -t cifs -o user=joe,pass=shmo,vers=1.0 //server/share /mnt/share