Windows 10 Ubuntu Bash Shell: How Do I Mount Other Windows Drives?

71

19

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.

Jason Champion

Posted 2016-08-16T22:45:29.793

Reputation: 811

1

Are you sure they aren't there (/mnt/e etc)? That's where they should be by default. https://blogs.windows.com/buildingapps/2016/03/30/run-bash-on-ubuntu-on-windows/

– Argonauts – 2016-08-16T23:12:26.417

4Mounting is currently not supported and something that we are aware of. We will be looking at the User Voice page to prioritize what features to light up next. So, please do provide your feedback there as well. - From Microsoft themselves. You'll have to wait till it's fixed. – Don't Root here plz... – 2016-10-05T17:18:25.617

5

Possible duplicate of Accessing removable media in Bash on Windows

– The Guy with The Hat – 2017-11-20T21:23:24.790

Answers

77

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

Posted 2016-08-16T22:45:29.793

Reputation: 1 454

2Hi David, thanks for your suggestion. Feel free to indicate duplication. This answer is well tailored to the question. Feel free to edit it if you can improve it or comment with suggestions if you don't have the reputation to do that. – user643011 – 2017-05-16T19:35:47.177

4The OPS asked "how do I mount...", so IMHO this is the answer I appreciated the most (and as a bonus, even offers the answer to mount network shares) – HidekiAI – 2017-07-11T16:28:40.577

1Can this be made permanent? I have tried to follow guidance on modifying /etc/fstab for regular linux, but they don't seem to apply to WSL. – Adam Crossland – 2018-05-01T20:25:39.073

@AdamCrossland: That has been added recently. Check if you have at least Windows version 10.0.17093. Open a shell with "cmd" and run "ver" to check. If you have an older version you need to upgrade. You probably have to opt-in to Windows Insider updates first. Source: https://github.com/Microsoft/WSL/issues/2636#issuecomment-364172586

– user643011 – 2018-05-08T12:25:44.637

1@user643011, thanks, it worked! :) – Lukasz Czerwinski – 2018-09-20T12:00:22.910

Found this in 2020. Is it reasonable to have a recurring script to check if a windows drive has been added, then run the linux command to mount the drive?

this might be the solution. hoping someone with more experience in powershell & task scheduling can recognise if this is viable or best solution in 2020. https://superuser.com/questions/219401/starting-scheduled-task-by-detecting-connection-of-usb-device

– aspiringGuru – 2020-01-01T22:26:37.787

14

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

Posted 2016-08-16T22:45:29.793

Reputation: 249

Makes sense. Those drives are ext4 volumes and mounted using ext2fsd from http://www.ext2fsd.com/ and I never would have imagined they wouldn't be recognized by a Linux kernel. That explains why.

– Jason Champion – 2016-10-12T19:04:29.503

1@JasonChampion: with Windows 10's Ubuntu Bash shell there is no Linux kernel. That's why it wouldn't work before. – user643011 – 2017-07-12T16:19:55.100

@mementum but in my case the filesystem is ɴᴛꜰꜱ and it doesn’t mount anyway. – user2284570 – 2019-03-30T11:13:05.110

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.

Anton Liakhovitch

Posted 2016-08-16T22:45:29.793

Reputation: 571

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. :(

dimitarvp

Posted 2016-08-16T22:45:29.793

Reputation: 63

The question is about local drives. – user2284570 – 2019-03-30T11:13:43.483