Mounting network share under WSL

I moved my repos from internal SSD to external NAS storage and was working on them in VS Code until I neeed to run it from WSL console…

It appears that WSL is not mounting removable and network shares/devices by default. As said in old microsoft post in comment section:

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.

But fortunately we can do it now without problems as drvfs recognizes windows drive letters and we can use it to mount our network share.

All we need to do is create a place for it or use existing folder and mount it there. In my case I created new path under /mnt/share and then mounted it (my NAS is listed as Z). Just like that:

$ sudo mkdir /mnt/share
$ sudo mount -t drvfs Z: /mnt/share/

And it worked.

root@TITAN:/mnt/share# ll
total 0
drwxrwxrwx 1 root root 512 Sep 14 19:02 '#recycle'/
drwxrwxrwx 1 root root 512 Sep 14 18:52 ./
drwxr-xr-x 1 root root 4096 Sep 14 20:48 ../
drwxrwxrwx 1 root root 512 Aug 25 14:15 0-Archive/
drwxrwxrwx 1 root root 512 Aug 25 14:15 '1-OLD HDD'/
drwxrwxrwx 1 root root 512 Aug 6 23:38 'Piorek HDD'/
drwxrwxrwx 1 root root 512 Sep 14 18:52 Repos/
drwxrwxrwx 1 root root 512 Aug 10 15:56 Video/
drwxrwxrwx 1 root root 512 Sep 10 19:19 Youtube/

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.