Win 10 Linux Subsystem: Auto-mount network drives
Solution 1:
WSL does process fstab, but only as of build 17093. Assuming you're using an earlier version, you'll probably need to write a script to do the mount and invoke it manually.
Solution 2:
Windows build 17093 is supposed to fix the fstab problem, but at the moment it is only an Insider Build, so not advised for stability.
You can effectively accomplish this by writing a .bash
_login script in your home directory like this:
if [ ! -e full_file_name ]
then sudo mount --bind ...
fi
Just replace the mount command by whatever mount commands you want, and
full_file_name
with a file-name that will reliably exist if your mounts
are in place.
The first Linux window might require you to type your Linux password, but later windows will not.
Solution 3:
I ran into the same problem.
I am running Windows 10 Enterprise Version 1709, OS Build 16299.431
What I did is I added to the top of /etc/bash.bashrc
the following line:
sudo mount -t drvfs '\\127.0.0.1\MyDrive' /mnt/MyDrive
I am not saying this is the best way to go about it, but I was sure tired of having to mount the drive every time I started WSL bash.
Solution 4:
I ran into the same problem.
What I did to fix it was, go to the /etc/bash.bashrc
and add the below script at the top:
sudo rm -r /mnt/d
sudo mkdir /mnt/d
sudo mount -t drvfs D: /mnt/d
Please note that D is my network drive.