Skip to content

Instantly share code, notes, and snippets.

@KreAch3R
Last active August 23, 2018 16:27
Show Gist options
  • Save KreAch3R/ffb7aac527a812920c19fd10ef45f52d to your computer and use it in GitHub Desktop.
Save KreAch3R/ffb7aac527a812920c19fd10ef45f52d to your computer and use it in GitHub Desktop.
WSL: Mount network drives through /etc/fstab

Mount Network drives through /etc/fstab in WSL Bash

You can mount network drives and use them everywhere in WSL Bash.

Following these github issues:
microsoft/WSL#2636 (comment)
microsoft/WSL#2930 (comment)

1. Create /etc/fstab if it doesn't exist

2. Create all the folders you want to use as mount points

E.g. if you want to mount your C:, D:, E: drives to /mnt/c, /mnt/d, /mnt/e, you will need to create them.

sudo mount /mnt/c /mnt/d /mnt/e

3. Mount a network drive like this:

//DEVBOX/Data                    /mnt/d   drvfs  defaults     0 0

4. You can also bind your /mnt/X mount point to a more Windows like mountpoint like /c.

/mnt/c                           /c       none    bind        0 0

Do not forget to create your /c mount points with sudo mkdir /c.

5. Test your current configuration with

sudo mount -a

Current running example

//SERVER/D                       /mnt/d   drvfs  defaults     0 0
//SERVER/E                       /mnt/e   drvfs  defaults     0 0
/mnt/c                           /c       none    bind        0 0
/mnt/d                           /d       none    bind        0 0
/mnt/e                           /e       none    bind        0 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment