Score:0

How to attach WSL image on external drive to fresh Windows install?

mo flag

I recently did a fresh install of Windows 11 (I had windows 10 before that). I also was using WSL2 for work and .vhdx image was on external drive (what I mean by it is that the image is simply on another SSD within my desktop PC). How can I connect that vhdx image to my Windows 11 machine to be able to use it again?

I terminated and unregistered fresh Ubuntu image that was mounted to disk C and tried the following command I found:

wsl --import Ubuntu-20.04 U:\Ubuntu-20.04 U:\Ubuntu-20.04\ext4.vhdx --vhd

But it didn't work and threw an error

Error code: Wsl/WSL_E_DEFAULT_DISTRO_NOT_FOUND

Score:0
kg flag

Replication

I replicated your situation and got an error, altough not the one you report. Can you do also wsl --list --all so we can see what distros you have, and which one is the default?

The error I got

wsl --import <Distro> <InstallLocation> <FileName> [Options]

When you import a distro, WSL copies the drive to InstallLocation/ext4.vhdx. It seems that your exitsing vhdx may be colliding with the one generated by WSL. You can instead use:

wsl --import-in-place <Distro> <FileName>

so as to use the file you already have. Alternatively you can choose a diferent install location.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.