How to solve the problems caused by WSL 2's filesystem changes?

Ever since I upgraded to WSL 2 the builds of my projects (that I have on a local NTFS drive) are horribly slow. For example if I build a project from windows, I get 20-30s build times, the same from WSL2 is around 3 minutes.

Another problem is that the file watch functionality doesn't work at all, so I can't use programs that would listen to changes on my filesystem.

I was told that a solution for this is to simply move my projects into a WSL-managed filesystem. This is a good idea, but then I can't open my projects from my IDE of choice (IntelliJ IDEA).

Is there a trivial solution for this problem? Can I access files stored in a WSL 2 filesystem from a regular IDE somehow?

2 Answers

Same issue(s) as a fullstack dev I routinely find myself needing to run a build process in WSL2 and change files in Windows (i.e. SVG files in Affinity publisher, inkscape, etc.).

Move your project(s) folder into the WSL2 filesystem (ext4 or whatever), this way you get posix permissions, inotify 'monitor' filesystem hooks work, etc. and performance is much faster.

THEN TO ACCESS the Linux WSL2 filesystem in Windows Explorer (i.e. via any Windows App) Use path \\wsl$\

TIP: spend the 3 seconds to create a shortcut in your default documents, downloads, etc. directories that points directly to your \wsl$\projects\folder

1

As stated in , WSL1 outperforms WSL2 w.r.t. "performance across OS file systems". One solution, provided you don't rely on other WSL2-specific features, is to set your image's WSL version to 1 by using wsl --set-version <distribution name> <versionNumber=1>.

Regarding the "regular IDE access to WSL2 file system" aspect, I can't tell for IntelliJ but Visual Studio Code offers a neat integration with WSL2 images (i.e. running native on Windows while offering file system and bash access for Linux). See for example or .

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like