This post shows students and new users steps to mount or map a network drive or folder in Windows Subsystem for Linux (WSL). In Windows 11, users can map network drives and folders with ease. If you know the path to a shared folder and have access to the location, you should be able to map it easily.
Similarly, users can mount or map network locations in WSL environments. Any network location within Windows can be mounted or mapped in the WSL Linux shell.
In a WSL environment, users can mount network locations in two or more ways. One way is to map a network folder, like mounting a removable drive in WSL. Once the drive is mounted with a drive letter, you can use the mount command to map the drive to a mount point in Linux.
The commands below can mount a network drive assigned to the letter F in the WSL environment.
sudo mkdir /mnt/f sudo mount -t drvfs F: /mnt/f
Mapping a network folder follows a similar approach.
How to map a network folder in Windows Subsystem for Linux
As mentioned above, any network location you can reach from within Windows can be mounted or mapped from the Linux shell.
If you know the UNC (Universal Naming Convention) path for a particular folder or drive and can access the location, you can mount it in the WSL shell environment.
For example, if the path to the network share is \\server\documents, you can run the commands below to mount it in WSL.
First, create a mount point in Linux where you’d want to map the shared network folder. Run the commands below to create a mount point if it’s not already created.
sudo mkdir /mnt/documents
Once the mount point is created, run the commands below to mount the network share.
sudo mount -t '\\server\documents' /mnt/documents
If the network location is password protected, you may have to use the net use command to map the location instead.
For example, you can use the net use command to mount the network path \\server\documents with the username Joe and the password MyPassword to map it to your F: drive.
net.exe use f: \\server\documents /user:Jdoe MyPassword
That should mount the network location mapped to the F drive in WSL. To unmount, simply run the commands below.
sudo umount /mnt/documents
That should do it!
The post below also shows you how to mount a removable drive in WSL.
How to mount a removable drive in Windows Subsystem for Linux.
Conclusion:
- Mapping or mounting network drives and folders in Windows Subsystem for Linux (WSL) is straightforward.
- Users can easily access shared folders by knowing the UNC path and using the appropriate commands.
- It is essential to create a mount point in WSL before mapping network locations.
- For password-protected shares, the
net use
command can facilitate access by providing credentials. - Unmounting is as simple as using the
umount
command followed by the mount point. - Familiarizing yourself with these commands can enhance your productivity when working in WSL.
By following these steps, students and new users can effectively leverage the capabilities of WSL to manage network resources efficiently.
Leave a Reply