Accessing removable media in Bash on Windows
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/
Is there a way to access removable media from within Bash on Windows?
Update:
Apparently it is now possible starting from Windows 10 Build 16176.
See https://superuser.com/a/1209701/337631.
No.
At the moment there are limitations on what drives are mounted:
In order for a drive to show up under /mnt/ it must meet the following criteria:
- The drive must be a fixed drive
- The drive must be formatted to NTFS.
This has been raised as an issue: Drives other than C: are not mounted in /mnt #1079. It is still marked as "Open".
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.
Source WSL File System Support
Further Reading
- WSL File System Support
To add on to the existing answers: if you install an ext driver for windows (e.g. Ext2Fsd) you can mount and ext flesystem like you would an NTFS filesystem. This can be useful if you want to mount Raspberry Pi SDCards.