How to Convert WSL 1 Linux Distribution to WSL 2 in Windows Subsystem for Linux
Windows Subsystem for Linux 2 is much faster than WSL 1. If you convert your distributions to WSL 2, you will experience significantly faster IO performance, 3 to 6 times faster performance compared to WSL 1.
To update WSL 1 distro to WSL 2, we use the wsl --set-version
command:
wsl --set-version <distro_name> <version>
We can get a list of all distros and the architecture that Linux distributions are using with the wsl --list -v
command.
For example, I can now convert my Kali Linux distribution to use Windows Subsystem for Linux 2 as follows:
wsl --set-version kali-linux 2
It is also possible to downgrade a WSL2 Linux distro to WSL1:
wsl --set-version kali-linux 1
Run the following command to make WSL2 the default version for all future Linux distributions you will install on Windows 10.
wsl --set-default-version 2
Note that you must first enable WSL 2 before changing a WSL Linux distro to WSL 2 or you will get an error such as Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS
.