How to Mount Removable Drives and Network Locations in the Windows Subsystem for Linux

Beginning with the update of the creators of Autumn Windows 10 the Windows Subsystem for Linux now allows you to manually mount drives. It always automatically mounts all internal NTFS drives. However, you can now manually mount external drives and network folders using the Linux mount command.

How to mount external devices

The Windows Subsystem for Linux always automatically mounts fixed NTFS drives. So, if you have an internal C: drive and a D: drive, you will see them in / mnt / c and / mnt / d in the Linux environment.

DrvFs now allows you to mount external drives such as thumb drives, CDs and DVDs. These devices must use a Windows file system such as NTFS, ReFS or FAT . You still can not mount the devices formatted with a Linux file system as ext3 or ext4.

As with internal drives, these external drives will remain accessible in Windows after mounting them in the Linux environment. Mounting them also makes them accessible from the shell environment.

Let's say you have an external G: drive that represents either a USB drive or an optical drive. To mount it, you must execute the following commands:

sudo mkdir / mnt / g

sudo -t drvfs G: / mnt / g

You do not need to mount the drive on / mnt / g, of course. You can mount it where you want. Simply replace the two instances of / mnt / g in the commands with the desired path.

To dismount the drive later, you can delete it safely run the command umount standard:

sudo umount / mnt / g /

When working with an external device formatted with a FAT file system or network file system, there are some limitations. The file system will not be case sensitive and you can not create symbolic links or physical links.

How to mount network locations

You can also mount network locations. Any network location that you can reach from Windows, you can mount from the Linux shell.

Network locations can be mounted in two different ways. If you map a network drive to a drive letter you can mount it using the same options as above. This will give you the opportunity to easily connect to the network share and enter your credentials in the file explorer. For example, if your mapped network drive is F:, you can run the following commands to mount it:

sudo mkdir / mnt / f

sudo -t drvfs F: / mnt / f

You can also specify a drive using its Universal Naming Convention (UNC) path. For example, if the path to the network share is \ server folder, you must run the following command. Again, use any mount point you like in place of /mnt/folder.

sudo mkdir / mnt / folder
sudo mount -t \ server folder & # 39; / mnt / folder

The Windows Subsystem for Linux environment provides no way to specify the credentials that you want to use. You can specify the credentials by accessing the folder in the Windows File Explorer, entering them via Credential Manager or by using the net use command .

You can run the net use command from the Linux environment because the Windows for Linux subsystem allows you to launch the Windows software from the Linux command line. Just run the command as follows:

Using net.exe

For example, the following command would connect to \ server folder with the Bob user name and the LetMeIn password and map it to your F: drive. Here is the command you will execute:

net.exe uses f: \ server folder / user: Bob LetMeIn

After logging in once, Windows will remember this username and password and use them automatically, even if you use the mount command in the Linux environment.

To unmount a network location, you can use the standard umount command, once again:

sudo umount / mnt / folder

DrvFs does not set Linux permissions accurately when you mount a network location. Instead, all the files on the network file system seem to have full access permission (0777) and you can only see if you have access to a file by trying to open it . The file system will not be case-sensitive and you can not create symbolic links on it

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.