WSL icon indicating copy to clipboard operation
WSL copied to clipboard

The command wsl --unregister ubuntu22.04 deletes ext4.vhdx permanently

Open hitbuyi opened this issue 7 months ago • 9 comments

My WSL info Win10:22H2,19045,6466 WSL: WSL 版本: 2.6.3.0 内核版本: 6.6.87.2-1 WSLg 版本: 1.0.71 MSRDC 版本: 1.2.6353 Direct3D 版本: 1.611.1-81528511 DXCore 版本: 10.0.26100.1-240331-1435.ge-release Windows: 10.0.19045.6466

I import ubuntu22.04 by using import command, and accidently use wsl --unregister ubuntu22.04

and found my 100G ext4.vhdx is deleted permamently from my hard disk, and can't recovered by any data recoverty software Is there any remedy to recover my 100G ext4.vhdx data? I think this is a bug of WSL2

hitbuyi avatar May 03 '26 11:05 hitbuyi

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The script will output the path of the log file once done.

If this is a networking issue, please use .\collect-wsl-logs.ps1 -LogProfile networking instead, following the instructions in Collect WSL logs for networking issues

Once completed please upload the output files to this GitHub issue.

See Collect WSL logs (recommended method).

If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.

github-actions[bot] avatar May 03 '26 11:05 github-actions[bot]

The log file doesn't contain any WSL traces. Please make sure that you reproduced the issue while the log collection was running.

Diagnostic information
Detected appx version: 2.6.3.0
Found no WSL traces in the logs

github-actions[bot] avatar May 03 '26 11:05 github-actions[bot]

The file was deleted permanently, I can't reproduce the event

The log file doesn't contain any WSL traces. Please make sure that you reproduced the issue while the log collection was running.

Diagnostic information

hitbuyi avatar May 03 '26 11:05 hitbuyi

I think this is intentional

fluentmoheshwar avatar May 04 '26 11:05 fluentmoheshwar

This is by design. See the help message:

 --unregister <Distro>
        Unregisters the distribution and deletes the root filesystem.

OneBlue avatar May 04 '26 18:05 OneBlue

Which fking genius programmer think it is a good ideal to include the meaning of DELETE in --unregister command?

Lisherex avatar Oct 24 '26 08:10 Lisherex

13. Which fking genius programmer think it is a good ideal to include the meaning of DELETE in --unregister command?

I think this is real BUG, but the WSL don't recognize it. Don't use WSL to process your important data

hitbuyi avatar Oct 26 '26 05:10 hitbuyi

14. > 13. Which fking genius programmer think it is a good ideal to include the meaning of DELETE in --unregister command?

 I think this is real BUG, but the WSL don't recognize it.  Don't use WSL to process your important data

There are many other issues regarding this brilliant design. https://github.com/wslkit/wslkit/issues/29

I have accepted the loss and move on. :)

Lisherex avatar Oct 26 '26 05:10 Lisherex