How to Mount and Access Hard Drives in Windows Subsystem for Linux

When you finish installing WSL and open the terminal for the first time, you’ll probably be wondering how to access the files on your C: drive or other hard drives, flash drives, etc.

WSL will mount your hard drives for you automatically under the /mnt directory. The C: drive can always be accessed there, and usually other fixed NTFS drives that you have installed will be mounted there as well. But if you don’t see them, they are easy to mount.

Accessing the C: drive

Your main hard drive should always be accessible under /mnt/c

A simple change directory command should take you to the root of your C: drive…

cd /mnt/c

Accessing other drives and removable media

If you have a second hard drive or removable media such as a flash drive, you can try accessing them through the /mnt directory as well, obviously by appending the appropriate drive letter to /mnt/

If you can’t access your drives/media that way, you’ll just need to mount them first, which Windows has made very simple in WSL. In this example, we’ll mount and access drive D: in Ubuntu on Windows Subsystem for Linux.

Mounting:

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

Accessing:

cd /mnt/d && ls

You can mount your media anywhere you’d like; the thing to note here is that you must use Microsoft’s DrvFS when mounting accessible media within the subsystem.

In the case of removable media, you unmount them in the traditional way for safe removal:

sudo umount /mnt/d

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>