DEV Community

Ryan Palo
Ryan Palo

Posted on

7 3

Mounting Network Drives into Windows Subsystem Linux

This was initiated by my last article where I was counting directories on the command line.

At the end of the article, I wanted to show how it was done on the Linux CLI too, but I quickly ran into the problem that our server wasn't mounted into the Windows Subsystem Linux (WSL) file system. As it turns out, it's easier than I initially thought it would be!

Microsoft uses a new type of file system called DrvFs behind the scenes to allow the Linux subsystem to talk to native Windows directories. So you end up mounting a network drive just like you would mount any other media normally.

Let's say you've got a server on your network usually accessible as \\stroopwafel. To mount it into your WSL, you can do the following (I'm using Ubuntu, but it should be similar for the other distros):



sudo mkdir /mnt/stroopwafel
sudo mount -t drvfs '\\stroopwafel' /mnt/stroopwafel


Enter fullscreen mode Exit fullscreen mode

Note: I used single quotes to avoid awkwardness around the backslashes in the network drive name.

If you have mapped the network drive to a drive letter on your Windows system already--let's say \\stroopwafel is mapped to S:\--or if you've just got a removable drive that isn't mounted yet but has a letter on your Windows system, the syntax changes a little:



sudo mkdir /mnt/stroopwafel
sudo mount -t drvfs S: /mnt/stroopwafel


Enter fullscreen mode Exit fullscreen mode

If you ever want to unmount it:



sudo umount /mnt/stroopwafel


Enter fullscreen mode Exit fullscreen mode

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (1)

Collapse
 
marvinxu profile image
Marvin

➜ ~ sudo mount -t drvfs Z: /mnt/z
<3>WSL (3449) ERROR: MountWithRetry:307: mount(drvfs, /mnt/z, 9p, 0x00000000, cache=mmap,msize=262144,trans=virtio,aname=drvfs;path=Z:;symlinkroot=/mnt/) failed: Invalid argument

Can you help?

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more