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

How to Create a Custom Keyboard Layout in Windows

Windows comes with a lot of different keyboard layouts, most of which are used to accommodate foreign language keyboards. If none of the default layouts within Windows fit your needs, you can always create your own.

When I started learning Spanish, I needed to be able to type a few characters that we don’t have in English: á, é, í, ó, ú, ñ, ¿, and a couple others. To do this easily, I had to use a Spanish keyboard layout that was built into Windows.

The problem I ran into was that it made a lot of other (undesirable) changes to my keyboard, instead of just providing me with the new characters that I needed to use. And while writing these characters was now way easier than before, I knew I could make a much more intuitive keyboard myself. So that’s what I did.

The following guide will take you through my process of creating a custom Spanish keyboard layout for my American keyboard. If you have an idea for how you’d like your custom key mappings to be, you can follow along with me to create your own custom keyboard.

How I envisioned my keyboard

The Spanish keyboard that comes with Windows did some things I didn’t like. For example, it turned my semicolon (;) key into an ñ. Well, that’s fine, even though it’d take some getting used to. But… where did my semicolon key go? I don’t know, nor do I care to always remember where its new home is. And the same goes for all the other keys it displaced. In short, I just didn’t find this keyboard layout to be very intuitive.

I decided that I’d much rather just be able to hit my left bracket key (ya know, this thing: [ ) followed by the character I wanted to modify with an accent or tilde. So, if I wanted to write ú, I could just type [ and u. If I want to write ñ, I type [ and n. And instead of displacing my [ key, how about I access it by tapping it twice. Much simpler, right? Yeah, but we’ll need to create a custom keyboard layout for that to happen.

Microsoft Keyboard Layout Creator

Microsoft made a handy little program just for this purpose, which can be downloaded right from their website. If that link stops working for some reason, we host it on DDT as well. Once you’ve downloaded it, run it and go through the install prompts (all very self-explanatory).

Once the installation is finished, you can open the program through the Start menu.

You’ll be presented with a blank keyboard layout initially, totally customizable from the ground up:

It’s a lot easier to just use our current keyboard layout and then customize it with our new specifications. You can load your current keyboard through File > Load Existing Keyboard…

Choose your current keyboard layout in this menu. If you’re using a regular American keyboard, select ‘US.’

The keyboard should look filled out now and we can begin to make our personalizations.

Setting a ‘dead key’

You can rearrange or reprogram these keys as you please, but if you’d like to add additional characters to the keyboard, you’ll have to use a ‘dead key.’ As I said earlier, I access Spanish characters by first pressing [ on my keyboard. In other words, the left bracket is my dead key.

Right-click on the key and hit ‘Set as dead key.’

A new window will open, where you can set your additional keys.

As you can see in the screenshot above, I’ve begun to enter a few Spanish characters. The dead key + base key forms the composite key. So the first row indicates that ‘[‘ followed by ‘n’ will create ‘ñ’. The ‘U+006e’ and similar information is created automatically – just type your characters as normal and that other information will populate automatically.

You can just google for custom characters that you need, and paste them into the composite column. But after we finish saving this keyboard, you’ll be able to make those characters yourself!

Our left bracket key can now be used to make a lot more characters, but we still may need to use the left bracket key itself from time to time. You can enter ‘[‘ in the base and composite columns so that double tapping the left bracket key will still output a left bracket.

Here’s how it looks now that I’ve finished filling out all the Spanish characters I need:

Save and enable your new keyboard

Click OK when finished with the dead key setup. Go to File > Save in order to save your new layout somewhere. More importantly, we need to build an executable version of the new keyboard, so it can be installed on your computer (and other computers if you share the file or plan to switch PCs).

First, click on Project > Properties to name your layout.

Type the relevant information here and click OK when finished.

Click on Project > Build DLL and Setup Package

If you get a warning, don’t worry, it’s safe to proceed. You should get a dialog at the end saying that your files were successfully saved:

Click Yes to see your newly created files. In order to install your newly created custom keyboard, just run setup.exe

With installation successfully completed, you can select your keyboard in the taskbar.

How to Disable the Windows Key

The windows key on your keyboard is easy to hit accidentally when playing a full screen game. If you are sick of unintentionally minimizing your game, there’s a simple fix you can apply to disable your windows key.

This little hack involves editing the registry. If you want the simplest and quickest solution possible, we’ve made a registry file that will make the change for you, so you don’t have to dig into the registry to make the edit manually.

Simply download Disable_Windows_key.reg and run it. You’ll have to restart your PC in order for the changes to take effect. Note that you may have to right-click that link and click ‘Save link as’. If you need to re-enable the Windows key later on, you can download and run Enable_Windows_key.reg

The Manual Process

If you’d like to make the change manually or are curious what that little file is doing, here are the step-by-step instructions for editing the registry yourself to disable the Windows key:

Open regedit by clicking start and typing ‘regedit’.

In the left pane, navigate to:

Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout

You’ll do this by expanding the arrows of each folder (see image below) in the left pane, until you finally reach ‘Keyboard Layout’.

Once you have reached Keyboard Layout, click it once so it’s highlighted, and then right click on a blank area in the right pane and select New > Binary Value.

Name this new key Scancode Map and press Enter.

Now, double-click on the newly created Scancode Map key in order to edit it. You have to enter this monstrosity of a value in the Data Field, and it’s not able to be done via copy+paste.

00000000000000000300000000005BE000005CE000000000

When you are done typing that long value, it should look exactly like this screenshot below.

As long as your newly added registry key looks exactly like this, all that’s left to do is click OK and restart your PC. When you boot back up, hitting the Windows key should no longer have any effect and you can get back to some hassle-free gaming!

Re-enabling the Windows key

If you need to re-enable the Windows key, you’ll have to navigate to the same area of regedit, right-click on the Scancode Map key you created, and delete it.

Image credit: I G on flickr