Tabla de contenido
Windows Subsystem for Linux (WSL) is a feature of Windows that allows users to run a Linux environment on Windows. One of the advantages of WSL is that users can access files on their Windows hard drive from Linux, allowing them to work on Linux projects using files stored on their Windows hard drive.
In this article, we’ll show you how to mount a disk in WSL and access it from Linux. Keep reading to learn more.
What is WSL?
WSL is a feature of Windows that allows users to run a Linux distribution on Windows. WSL is a compatibility layer that translates Linux system calls into Windows system calls, allowing users to run Linux applications on Windows.
WSL is an extremely useful feature for developers who need to work on Linux projects while using Windows as their primary operating system. The ability to access Windows files from Linux in WSL is one of the advantages of this feature.
How to mount a disk in WSL
Mounting a disk in WSL is a simple process that can be done with a few commands on the command line.
Open the “Terminal” application in WSL. If you don’t have WSL installed, you can download it from the Microsoft Store.
Type the following command in the terminal to ensure you have the necessary permissions to mount the disk:
sudo mkdir /mnt/e
This command will create a folder called “e” in the /mnt location. The “sudo” prefix will give you administrator permissions to run the command.
Next, mount the E: disk to the /mnt/e folder with the following command:
sudo mount -t drvfs E: /mnt/e
This command uses the “mount” tool to mount the E: disk to the /mnt/e folder. The “-t drvfs” parameter indicates that the Windows file system driver is being used to mount the disk.
Now you should be able to access the E: disk from the WSL terminal in the /mnt/e folder. You can switch to the E: directory with the following command:
cd /mnt/e
How to access a mounted disk in WSL from the shell
Once you’ve mounted the disk in WSL, you can access it from the Linux terminal.
Open the Linux terminal in WSL.
To access the E: disk, switch to the /mnt/e directory with the following command:
cd /mnt/e
Now you should be able to see the files and folders on the E: disk from the Linux terminal in WSL. You can use the usual Linux commands to work with these files and folders.
How to unmount a disk in WSL
To unmount a disk in WSL, use the following command:
sudo umount /mnt/e
This command will unmount the E: disk from the /mnt/e folder in WSL.