Skip to content
Luca Dell'Oca Principal Cloud Architect @Veeam
Virtual To The Core Virtual To The Core

Virtualization blog, the italian way.

  • Media
  • About me
Virtual To The Core
Virtual To The Core

Virtualization blog, the italian way.

Migrate WSL (Windows Subsystem for Linux) to a new computer

Luca Dell'Oca, May 7, 2025
Recently I received a new company laptop, so among other things I wanted to migrate my existing WSL installation with Ubuntu 22.04. I didn’t want to reinstall and reconfigure all the software in the virtual machine, so I looked for ways to migrate the entire system.
Here’s the process, you will find out it’s very straightforward!

On the old computer

I check which WSL installations I have, listing them with this command:
PS C:\Users\user> wsl --list
Windows Subsystem for Linux Distributions:
Ubuntu-22.04 (Default)
Here’s my only subsystem. You may have more, in this case the procedure can be repeated for each of them. I can export it using this command:
wsl --export --vhd Ubuntu-22.04 ubuntu-export.vhdx
The -whd switch is followed by the distribution name I identified before, followed by a name I chose for the virtual disk that is created.

The duration of the process will depend on the size of the distribution disk and the speed of the computer, in my laptop it only took 10 seconds to create a file of 2.8 GB.
The last step on the old machine is to move this file into the new machine, via network or usb disk.

On the new computer

I first install WSL. Since Windows 11 22H2, wsl can be installed without any distribution, and that’s what I’ll do. In this way, I don’t have to delete a distribution I don’t need:
PS C:\Users\ldelloca> wsl --install --no-distribution
Downloading: Windows Subsystem for Linux 2.4.13
Installing: Windows Subsystem for Linux 2.4.13
Windows Subsystem for Linux 2.4.13 has been installed.
Installing Windows optional component: VirtualMachinePlatform


Deployment Image Servicing and Management tool
Version: 10.0.26100.1150


Image Version: 10.0.26100.3775


Enabling feature(s)
[==========================100.0%==========================]
The operation completed successfully.
The requested operation is successful. Changes will not be effective until the system is rebooted.
After the reboot, I import the exported distribution:
wsl --import-in-place Ubuntu-22.04 ubuntu-export.vhdx
This command takes just a few seconds.
Now, I can launch my Ubuntu subsystem in my new laptop:

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to email a link to a friend (Opens in new window) Email
  • Click to share on Tumblr (Opens in new window) Tumblr
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to share on WhatsApp (Opens in new window) WhatsApp
  • Click to share on Pocket (Opens in new window) Pocket
Tech migrationwsl

Post navigation

Previous post

Search

Sponsors

Latest Posts

  • Migrate WSL (Windows Subsystem for Linux) to a new computer
  • Pass keystrokes to a pfSense virtual machine to install it automatically
  • Automatically deploy pfSense with Terraform and Ansible
  • My Automated Lab project: #6 Create a S3 Bucket with Terraform
  • My Automated Lab project: #5 Deploy a Linux vSphere VM with Terraform and custom disks
©2025 Virtual To The Core | WordPress Theme by SuperbThemes
We use cookies to ensure that we give you the best experience on our website, and to collect anonymous data regarding navigations stats using 3rd party plugins; they all adhere to the EU Privacy Laws. If you continue to use this site we will assume that you are ok with it.OkNoPrivacy Policy