- 1 year ago
How to mount a substed drive in windows Ubuntu subsystem
In the Windows Subsystem for Linux (WSL), you can mount a substed drive by accessing it through the /mnt
directory. WSL automatically mounts Windows drives in the /mnt
directory, including those that are substed.
Here's how you can access a substed drive in WSL:
Open the Windows Command Prompt or PowerShell.
Use the
subst
command to create a drive letter mapping for the desired folder. For example, to create a virtual driveZ:
for the folderC:\Users\YourUsername\MyFolder
, use the following command:mathematicasubst Z: C:\Users\YourUsername\MyFolder
Open the WSL terminal (e.g., Ubuntu) from the Start menu.
Navigate to the
/mnt
directory to access the substed drive. For example, to access theZ:
drive, use the following command:bashcd /mnt/z
Now, you can use the
Z:
drive as if it were a regular Linux directory in your WSL environment.
Remember that any drive mappings created with subst
are specific to the Windows Command Prompt or PowerShell session in which they were created. If you want to access the substed drive in WSL in future sessions, you'll need to recreate the mapping in each WSL session or add the subst
command to your startup scripts.