It has been a couple of weeks since I moved from Linux to Windows, I was not using windows since Windows XP, it’s been a long time without windows so I’m feeling like a totally noob here.
One of the problems that I had in this migration is to read my mobile storage, for a long time I formatted my devices with ext4, mostly because in Linux there are not issues and to be able to save large files.
Now trying to read one of my devices in Windows I found that still is not plug and play, Windows by default still does not have support for ext4, however, the magic sauce of wsl is here to help.
Now is possible to mount a ext4 partition on windows using wsl, the partition is mounted inside of the wsl2 machine and we can access to it trough the shared folder. The amazing part of this is that you don’t have to install anything extra to browse other filesystems, you just need to use wsl2 and that’s it.
How to do it
First, open a powershell terminal as administrator.
Run this command to see the discs and the partitions
Get-wmiobject -query "SELECT * FROM Win32_DiskDrive"
Here you can see the deviceId, that is needed for the mount command. Also you can see the number of partitions, you’ll need to indicate which partition want to mount, in my case I have only one partition on the drive.
The command to mount is obviously mount, you have to run it into the admin powershell again. The format is
wsl --mount DISKPATH --partition NUMBER
Optional you can set the filesystem with -t. In my case, the mount command was this
wsl --mount \\.\PHYSICALDRIVE1 --partition 1
Finally, you can see the device using the file explorer under the Linux section, your machine, /mnt/wsl/DEVICEIDpartitionNUMBER.
For more info follow these links
So lets say for the sake of argument that you have a drive with 2 partitions one ext4 and the other NTFS. How would to be able to tell the two apart without do anything destructive?