5 ms·
Use WSL2 for non-dog-slow filesystem.
by dboreham 5y ago
Use WSL2 for non-dog-slow filesystem.
- LAC-Tech 5y agoI've got a hazy memory of trying this but had to back out because something broke. There was some big limitation of WSL2 I cant remember.
- Tenoke 5y agoI'd bet it was network access. It's a bizarre and common problem (I see more people commenting on the issues all the time) which you can kind of fix by forcing 8.8.8.8 or a different nameserver into /etc/resolv.conf but it's unclear to me why this doesn't work out of the box.
- LAC-Tech 5y agoyes that was 100% it! I use WSL to do web dev in a windows machine so I can use all my favourite tools. So no WSL2 for me (though that work around is worth a shot).
- andrewmackrodt 5y agoThis is true if you put your code in the Hyper-V managed WSL2 VM but now you have the reverse problem of WSL1, i.e. access via Windows P9 is slow and things like symlinks do not resolve whatsoever (on the Windows side). In WSL1, access to files on the Windows host is far quicker than WSL2 and symlinks work everywhere. To try to counteract this, I opted in to the insiders dev channel recently to try the upcoming X11 support, i.e. run IDEA inside WSL. While the performance is quite good, it's broken, e.g. try using find in project, the window disappears immediately 9 times out of 10. In many ways, I found WSL1 more useable as I could use one shell for both the Windows and WSL filesystems with reasonable performance. I now use cygwin if I want to use gnu linux type tools on Windows. Once the X11 support matures it will be a pretty good experience overall if people are willing to install things like IDEA in WSL, I'm looking forward to that.
- Tenoke 5y ago>In WSL1, access to files on the Windows host is far quicker than WSL2 and symlinks work everywhere. I find this pretty annoying, as I need to access Windows files from WSL more often than the opposite (e.g. get stuff from my Windows Downloads folder, or use bash to quickly interact with a Windows folder). Do you know if access to Docker volumes is faster or slower on WSL2 by the way? I wouldn't switch back to WSL1 since some nix/cabal stuff didn't work on WSL1 at all but I am curious as that's the other point where my windows/wsl filesystems touch in ways I've never looked into.
- andrewmackrodt 5y ago> Do you know if access to Docker volumes is faster or slower on WSL2 If your files are stored within the VM itself, WSL2's access to them is effectively native. However accessing the files from Windows requires going through the \\wsl$ (P9) network share. This presents problems as Windows isn't going to receive file notification events if you do something like `git checkout`. Additionally, if your project utilizes symlinks, Windows only sees them as an empty file. Users of VS Code largely will not encounter these problems as running `code` from within the WSL layer will start a remote server, it's seamless, that's genuinely very cool. However, if you use anything else, I've found it to be problematic. The "best" solution I arrived at (other than dual-booting Linux, which is totally worth it!) is to install `xorg-server` from cygwin, install my IDE of choice in WSL2 (IDEA) and use X11 forwarding. This way the IDE has a relatively real-time view of the filesystem, receives notification events, symlinks work, chmod is preserved if using safe-writes etc. If you need to use bash (and other tools not provided by Git Bash), cygwin is a useful addition. You can also use `mklink` from cmd/powershell to create a directory hardlink to the \\wsl$ folder if you need to copy things into WSL (although it's easier to access /mnt/drive from WSL2). Either way, I've found any direction of crossing Host/VM filesystem boundaries to be slower than WSL1's approach.
- lugged 5y ago"wsl is real Linux" Why don't ya'll just use Linux? This just sounds so much more difficult than using the real thing.
- SXX 5y agoCan you now use WSL2 together with other hypervisors like VirtualBox or VMWare? A while back WSL2 required use of HyperV and that removes possibility to run other VM software. Big no go for anyone who also want to test software in other VMs
- beermonster 5y agoActually it’s only faster for native fs access IIRC. So if you need to access cross-fs WSL Legacy may be more performant.