Ben Chuanlong Du's Blog

And let it direct your passion with reason.

WSL2 Filesystem

Performance Issue

The performance of IO is extremely bad if you access the the Windows filesystem from WSL 2. This is also true if you use Docker in WSL 2 (since Docker on WSL 2 share the same kernel as WSL 2). It is suggested that you stick to WSL 2's own filesystem (instead of the Windows filesystem) when working in WSL 2, if IO performance is critical to your use case. For more details, please refer to How to Boost Docker with WSL2 .

If you are using Windows 11+, there is a trick to get good IO performance across filesystems. Windows 11 allows WSL 2 to mount an external hard drive directly. This means that if you have an external hard drive, you can mount it to WSL 2 to get good IO performance. When need good IO performance with the external hard drive from the Windows filesystem, you can umount the external hard drive and mount it to the Windows filesystem. Of course, this trick requires the external hard drive to be formatted in exFAT or NTFS (recommended) so that it can be recognized by both Linux (WSL 2) and Windows. For more details on this, please refer to the section "Mount Disk into WSL 2".

Mount Disk into WSL 2

Access Linux filesystems in Windows and WSL 2

Access WSL 2 Filesystem Using Windows Explore

  1. Open Windows explore.
  2. Type in \\wsl in the address bar.
  3. Click into the right directory to access files.

References

https://devblogs.microsoft.com/commandline/access-linux-filesystems-in-windows-and-wsl-2/

Comments