Windows – How to Backup WSL Before System Reset or Reinstall

backupbashreinstallresetwindows-subsystem-for-linux

My problem is that I have to reset or reinstall windows because of some problems but I spent a lot of time to configure WSL for development and don't want to lose it.

Is there any way of backing up the whole WSL with it's settings and installed modules, plugins, users etc and restore it after resetting or reinstalling windows? I searched a lot this topic but i couldn't find any useful information.

Otherwise if there's no way to backup, do windows 10 reset will delete WSL totally?

Best Answer

Windows 10 v1903 includes a built-in WSL export/import command. Specifically, wsl --export, which produces a tar and wsl --import, which imports a previously exported tar. You can then move this file between computers.

You can also specify stdin/stdout with -, which should allow you to directly transfer to another machine and import using a remote shell like ssh.

Related Question