128

I'm using Windows 10's Ubuntu Bash shell. It maps the C drive fine as /mnt/c.

I have other local physical hard drives, mounted in Windows as E: and F:

How do I tell Bash to mount these drives too (ideally automatically at /mnt/e and /mnt/f, but manual mounting is fine)? "sudo fdisk -l" doesn't seem to work (cannot open /proc/partitions), so I'm not sure how to find their names, otherwise I'd just use a regular mount command.

6 Answers6

154

Good news, it is now possible to mount USB media (including formatted as FAT) and network shares with drvfs on Windows 10:

Mount removable media: (e.g. D:)

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

To safely unmount

$ sudo umount /mnt/d

You can also mount network shares without smbfs:

$ sudo mount -t drvfs '\\server\share' /mnt/share

You need at least Build 16176 so you might have to opt-in to the Windows Insider programm and then update Windows. Source: https://blogs.msdn.microsoft.com/wsl/2017/04/18/file-system-improvements-to-the-windows-subsystem-for-linux/

user643011
  • 2,618
17

To facilitate interoperability with Windows, WSL uses the DrvFs file system. WSL automatically mounts all fixed drives with supported file systems under /mnt, such as /mnt/c, /mnt/d, etc. Currently, only NTFS and ReFS volumes are supported.

From: https://blogs.msdn.microsoft.com/wsl/2016/06/15/wsl-file-system-support/

If e: and f: have other filesystems like FAT, exFAT, they will not be automatically mounted.

mementum
  • 279
4

Those other drives should be there as well, in /mnt/e etc. You can check with ls /mnt. If they aren't, I'd try one of several things-

-Reboot your computer, make sure that the drives are plugged in, and then launch bash

-Reinstall Ubuntu by running lxrun/uninstall/full/y and then lxrun/install/y in cmd

-If nothing works, you can try making a symlink from the mount point of the usb drive to some folder on your C drive. I believe this article explains how to make them in Windows.

If none of this works, I would recommend reporting this as a bug to Microsoft. WSL is still under heavy development, and not nearly all of the features are working properly.

4

Consider a slight alternative on the currently top voted answer:

sudo mkdir /mnt/<usb_drive_letter>
sudo mount -t drvfs <usb_drive_letter>: /mnt/<usb_drive_Letter> -o uid=$(id -u $USER),gid=$(id -g $USER),metadata

For a USB drive which is assigned in Windows to H:, for example:

sudo mkdir /mnt/h
sudo mount -t drvfs h: /mnt/h -o uid=$(id -u $USER),gid=$(id -g $USER),metadata

In general, the other method will work, but note that drives that are manually mounted this way do not follow the normal WSL automount settings.

Most fixed Windows drives will be mounted:

  • In /mnt/<drive_letter for each drive.
  • With the default WSL user and its primary group as the owner of the mount.
  • A default umask/fmask/dmask of 000
  • The metadata disabled for performance, which means only a "simplified permission" model will be used to map Windows/NTFS and Linux permissions.

However, USB drives that are manually mounted do not follow the [automount] settings.

At the very least, you'll probably want your WSL user to be the owner, which is done with the -o uid=$(id -u $USER),gid=$(id -g $USER) (usually, this is the same as -o uid=1000,gid=1000 in a default Ubuntu/WSL installation).

Adding in the metadata option can be useful if you want to preserve permissions via rsync or cp -a.

NotTheDr01ds
  • 28,025
0

Very late to this party but here's the official issue: https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/13355724-unable-to-access-usb-devices-from-bash

In short, it's on their radar but it's not implemented yet. :(

-4

Try this only If you are using WSL Linux (downloaded from Microsoft Store)

1.cd /mnt 2.cd D/

First part is something like start mounting and then you can simply add any drives.