
In mixed environments where users operate both Windows and the Windows Subsystem for Linux (WSL), a frequent requirement is the ability to access Windows network drives directly from WSL. This guide provides a straightforward method for mounting Windows network drives in WSL, covering both temporary and permanent mounting.
To temporarily access a Windows network drive within WSL, follow these steps:
1. Identify the Drive Letter: First, identify the letter of the Windows network drive you wish to access. For demonstration purposes, we will use M: as our drive letter.
2. Prepare the Mount Point: If a corresponding folder for your drive letter does not exist under /mnt in WSL, create one with the command:
mkdir /mnt/m
3. Mount the Drive: Use the following command to mount the drive, allowing access until logoff:
xsudo mount -t drvfs M: /mnt/m
For continuous access to a network drive, you can configure the system to mount automatically at login:
1. Verify the Mount Point Exists: Ensure the existence of the mount target folder (e.g., /mnt/m).
2. Edit the fstab File: Open the file /etc/fstab and append the following line to enable automatic mounting:
M: /mnt/m drvfs defaults 0 0
3. Apply the Changes: To apply the changes, execute:
sudo mount -a
This guide aims to facilitate the integration of Windows network drives into the WSL environment, streamlining file management across both systems.