After announcing Windows Subsystem for Linux 2 (WSL 2) during Microsoft Build last year, Microsoft rolled out the feature to users with the Windows 10 May 2020 update (v. 2004) earlier this year. The update introduced a full Linux kernel to the stable Windows 10 branch, and the company also made WSL 2 updateable through Windows Update. Late last month, Microsoft announced that WSL 2 support was being backported to Windows 10 v1903 and v1909. And now, the company has announced an update for the feature.

How to build LineageOS on Windows 10 using WSL 2

According to a recent post on the Windows Command Line blog, starting with Windows Insider preview build 20211, WSL 2 will offer a new feature: wsl --mount. The post states that this "new parameter allows a physical disk to be attached and mounted inside WSL2," which will enable users to access filesystems that aren't natively supported by Windows, like ext4. In effect, the new parameter will allow users to access their Linux files from Windows even if they dual-boot Windows and Linux using different disks.

In case you already have Windows Insider preview build 20211 installed on your device, you'll be able to mount a disk by opening a PowerShell window with administrator privileges and running: wsl -- mount <DiskPath>. To list all available disks in Windows, you can run: wmic diskdrive list brief. Finally, to unmount and detach the disk from WSL 2, you can run: wsl --unmount <DiskPath>. Do note that you'll only be able to mount physical disks to WSL 2 and, at this time, it's not possible to mount a single partition.

Windows 10 WSL 2

Once you have the disk successfully mounted, you'll be able to access the disk through the Windows explorer. To do this, you'll need to navigate to "\wsl$" and then to the mounted folder. It's also worth noting that the wsl --mount command attempts to mount the disk as ext4 by default. If you wish to specify a different filesystem, or for more advanced scenarios, you can check out this documentation from Microsoft to learn how to do so.