pxlrbt / move-wsl

Easily move your WSL distros VHDX file to a new location.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pre-check: destination is not compressed

Kage-Yami opened this issue · comments

Describe the bug
If the destination import directory is marked as "compressed", the import stage will fail due to .vhdx files not being compressable.

Please add terminal output if possible:

jdsmi@YAMI ❯ ~\dev\scripts ❯
❯ .\Move-WSL.ps1
Getting distros...
Select distro to move:
1: docker-desktop
2: Arch
3: docker-desktop-data
1
Enter WSL target directory:
F:\docker\
Move docker-desktop to "F:\docker"? (Y|n): Y
Exporting VHDX to "F:\docker\docker-desktop.tar" ...
Unregistering WSL ...
Importing docker-desktop from F:\docker...
The requested operation could not be completed due to a virtual disk system limitation.  Virtual hard disk files must be uncompressed and unencrypted and must not be sparse.
Write-Error: Import failed. Distro not found. Export file at F:\docker\docker-desktop.tar

Disabled compression on the destination folder.

⨯ jdsmi@YAMI ❯ ~\dev\scripts ❯
❯ wsl --import docker-desktop F:\docker F:\docker\docker-desktop.tar
jdsmi@YAMI ❯ ~\dev\scripts ❯
❯

Script version:

  • Bash
  • Powershell
  • Batch

Please upgrade severity, it wiped my WSL vhdx.

Repro:

  1. Select compressed folder as target
  2. Get Error as described above.
  3. At this stage the WSL distro is unregistered and the source vhdx has been remove
  4. Uncompress target folder (containing the tar)
  5. Run BAT script again
  6. Discover its deleted the tar file, and there is no source file (ref Step 3)
  1. Run BAT script again
  2. Discover its deleted the tar file, and there is no source file (ref Step 3)

How did that tar file get removed? I'd expect the second run of the script to stop after exporting, since there is nothing to export anymore? 🤔 And in that case you should be able to manually import that .tar file.

Do you have any logs of the two runs?

Sorry didnt see any logs :-( I just reported my sequence of actions.

Perhaps whenever you pick up this issue you could add to your tests to see if you get a repro?

gl

I just tried reproducing this issue but could not. The distro got imported from a folder marked compressed just fine. Can one of you explain what you mean by compressed folder? As for me, I just went ahead and checked this option.
image

@SayakMukhopadhyay:
I just tried reproducing this issue but could not. The distro got imported from a folder marked compressed just fine. Can one of you explain what you mean by compressed folder?

I have no idea if this is still an issue, as I don't use WSL at this time, but the issue is when the destination is compressed, not the source folder from which your import .tar is in.

From memory, the core of the problem is that if the destination folder is marked as compressed, then Windows attempts to compress the newly-created .vhdx file (the would-be post-move distro), which is not allowed.

the core of the problem is that if the destination folder is marked as compressed, then Windows attempts to compress the newly-created .vhdx file

Yeah, I verified and that seems to be the case but it imported just fine in my case.
image
I have also ran the distro and it worked just fine. Do you have any further ideas?

@SayakMukhopadhyay
Do you have any further ideas?

Nothing off the top of my head, other than perhaps Microsoft has removed the limitation in Windows 11?

I found this issue microsoft/WSL#4103 but weirdly I still can't reproduce this.