A few months ago, Windows 10 Insider Preview Build 19603 added support for full “Linux file integration” in the File Explorer app, which allows you to access the files related to the Linux distros you have installed on Windows Subsystem for Linux 2 (WSL2).
Unlike Linux file integration, Microsoft has now introduced another new feature that lets you mount and access physical disks formatted in Linux filesystem like EXT4 in WSL 2. The feature is now available in the latest release of Windows Insider Preview Build 20211.
Using a new parameter
wsl --mount, you can attach a Linux format disk and access its content which is available in WSL 2. Here, WSL 2 mounts the device as ext4 filesystem by default, which you may know that Windows doesn’t support natively.
However, you can also specify other filesystems to mount disks by running the command:
wsl --mount <DiskPath> -t <FileSystem>
If you’re not well-versed with the command line, you can also access the Linux files on the Linux disk from Windows 10 (inside WSL 2) graphically through File Explorer (previously known as Windows Explorer) app. You can navigate to \wsl$ path and then to the mount folder.
The feature may seem exciting, but it also comes with limitations. For instance, as of now, it’s not possible to attach a single partition or mount ext4 partitions that are on the same physical disk as Windows OS.
Find your dream job
This is because the new improvement is only limited to separate physical disks. Also, you cannot attach USB flash drives even though it supports USB disks.
Now, if you want to get started with mounting a Linux filesystem in WSL 2, first update your Windows to the latest Build 20211 and then check out the official docs.