Accessing Linux System Files on Windows with WSL 2
For Gnu/Linux users, when we have at least 2 operating systems installed and Windows is running with Gnu/Linux, when we hear the word mount, we remember the command to mount Windows partitions on your Gnu/Linux using the mount command, where we can access the files.
It seems that Microsoft has accepted this reality of coexisting in a double boot with Gnu/Linux, making it possible from Windows to access the Gnu/Linux partition.
In the Windows Insider Preview 20211 to be able to make mount Gnu/Linux partitions they have created a new command for the Wsl the wsl –mount, that mounts inside WSL file types that are not normally supported in Windows like Ext 4 and then you can access the files of your Gnu/Linux partition from the console and the File Explorer.
To mount a disk, open a PowerShell window with administrator privileges and run:
wsl –mount <DiskPath>
To list the available disks in Windows, run:
wmic diskdrive list brief
To unmount and detach the disk from WSL 2, run
wsl –unmount <Diskpath>
The disks paths are available under the ‘DeviceID’ columns. Usually under the \\.\\\.