Closed jzebedee closed 1 year ago
The image was compacted from 195 GB to 88 GB. The problem during copy can be related to the reliability of the H: or C: drive. Any lock on the original image would have prevented the overwrite of the image, so the loss of the image is quite intriguing.
That is a simple PS Copy-Item instruction that should not cause any issues. I will include a safety check after copy just to avoid the removal of the temp folder in case of problems during the replacement of the image.
Were you using this or any other distro during the process?
No, the distro was not in use (and could not be in use, since it didn't exist). After running wslcompact and receiving the above error, it doesn't appear in wsl -l
and can't be used for commands:
>wsl -d Ubuntu -- pwd
There is no distribution with the supplied name.
Error code: Wsl/Service/WSL_E_DISTRO_NOT_FOUND
The original vhdx still exists with a plausible filesize at C:\WSL\ext4.vhdx
so I'm trying to import it into a new distro and recreate the one removed by wslcompact.
I still wouldn't expect an error during a file move to result in blowing away the distro.
If you still have the image, there are two ways to import it again. The fastest and simple one is the import-in-place. Just type:
wsl --import-in-place Ubuntu C:\WSL\ext4.vhdx
Ensure you have the latest WSL.
In version v8.0 I have added a safe exit in case of a failure during the image replacement, leaving the compacted image intact as a backup in the event of a failure while moving the compacted image to the new place.
After the failure, wslcompact continues running for other images as if nothing happened. The Ubuntu distro no longer appears in
wsl -l
and can't be used. The only file remaining in the temp directory is a 12MiB vhdx.