33

I'm using Ubuntu 16.04 over the Windows 10 Linux subsystem. When I plug in an NTFS external hard drive (D:) I cannot access it over the bash, when I run ls -la /mnt I get the following output:

rwxr-xr-x 1 root    root    512 Sep 21 19:04 .
drwxr-xr-x 1 root    root    512 Jan  1  1970 ..
drwxrwxrwx 1 <myusername> <myusername> 512 Sep 21 13:06 c
d????????? ? ?       ?         ?            ? d
drwxrwxrwx 1 <myusername> <myusername> 512 Sep 21 13:06 q

I also tried to mount the drive manually following this solution but the result is the same. The disk is accessible from PowerShell and from the file explorer.

Vasilis
  • 941
  • 1
  • 7
  • 11

3 Answers3

48

So I found the problem, I had to unmount it first and the mount it again:

sudo umount /mnt/d
sudo mount -t drvfs D: /mnt/d

This happened because it wasn't the first time I had connected this USB drive. The first time WSL (Windows Linux Subsystem) recognized and mounted the device automatically. But then I unplugged it without "Safe Remove" and without unmounting it through the command line. So, next time I re-connected the disk D: appears to be mounted in /mnt/d but not properly.

Vasilis
  • 941
  • 1
  • 7
  • 11
  • How can we make this permenant ? I'm trying to call a shell script directly from explorer or through another app. Mounting the share as the first line of the script wouldn't even do anything because WSL doesn't even see the file – hmedia1 Oct 01 '20 at 14:54
8

In my case, this was my first time trying to access the external drive on WSL. The solution that worked for me is from this SO post which I post below:

$ sudo mkdir /mnt/d
$ sudo mount -t drvfs D: /mnt/d

Notice I did not have to unmount it as WSL did not mount the unit when I connected it for the first time. To safetely unmount the unit:

$ sudo umount /mnt/d
K F
  • 191
  • 1
  • 3
0

Sometimes on my WSL version: 1.2.5.0 the accepted solution does not work. The only way to get the drive back is opening MS-DOS command line:

  • Windows + R
  • Type: cmd
  • Press OK (or Enter)
wsl --shutdown

Then after reopening the wsl window the mounted drive shows up again.

Altair7852
  • 123
  • 1
  • 5