How to Mount Linux File System in Windows 10
WSL 2 is the latest version of the architecture that powers the Windows Subsystem for Linux to run ELF64 Linux binaries on Windows. With recent changes, it allows accessing files stored on a drive with the Linux file system. If you have a drive with Linux installed, you can now mount it in Windows 10 and browse its contents with help of the WSL 2. Here's how it can be done.
WSL 2 ships a real Linux kernel with Windows that will make full system call compatibility possible. This is the first time a Linux kernel is shipped with Windows. WSL 2 uses the latest virtualization technology to run its Linux kernel inside of a lightweight utility virtual machine (VM). This new architecture changes how these Linux binaries interact with Windows and your computer’s hardware, but still provides the same user experience as in WSL 1.
Starting with Windows Insiders preview build 20211, WSL 2 offers a new feature:
wsl --mount. This new parameter allows a physical disk to be attached and mounted inside WSL 2, enabling you to access filesystems that aren’t natively supported by Windows (such as ext4). You can also navigate to these files inside of Windows File Explorer.
Here are the steps you need to perform.
- List the available physical disks in Windows 10.
- Mount the drive with Linux file system.
- Browse its content
- Unmount the drive.
Do it as follows.
To Mount Linux File System in Windows 10,
- Open PowerShell as Administrator.
- Type the following command to list the available physical disks, and press Enter:
wmic diskdrive list brief.
- See the
DeviceIDvalue to find the required drive.
- Type the following command to mount the drive, and press Enter:
wsl --mount DISKPATH [--Partition <number>. E.g.
wsl --mount \\.\PHYSICALDRIVE2 --Partition 1. Substitute the
Partitionvalues (if the drive has more than one partition) for the path of the Linux drive you want to mount.
- The drive with Linux files will be mounted, so you can access it with File Explorer. Type \\wsl$ into the File Explorer's address bar and hit Enter.
- You will see a folder named as the above DeviceID + partition number. Browse it as a regular folder on your hard drive.
- Once you finish, close File Explorer, and return to PowerShell. Type the command
wsl --unmount <DISKPATH>. E.g.
wsl --unmount \\.\PHYSICALDRIVE2.
You are done.
wsl allows specifying the file system type. WSL will try to guess it, but if it fails, when use the command as follows:
wsl --mount \\.\PHYSICALDRIVE2 --Partition 1 -t ext4
In the command above we are telling
wsl to mount the drive as the popular Ext4 FS.
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!