microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.26k stars 812 forks source link

WSL 2 Ubuntu Files Gone #4974

Closed engina closed 3 years ago

engina commented 4 years ago

See our contributing instructions for assistance.

Please fill out the below information:

BTW after I killed the launch process, later I noticed bsdtar in process explorer.

What could be the problem? Could this be reversed? (I've checked if there is a backup of the rootfs dir in AppData to restore from there, at least retrieve but unluckily there was none)

TW4177 commented 1 year ago

To anyone who has suffered data loss in WSL 2 fitting the patterns described here since this was closed, please add your report to #9830 and include as much info as you can collect to reproduce the scenario. Thanks!

Vitor-Almeida commented 1 year ago

Just lost my entire master's thesis. I have no idea what happend. my ext4.vhd file is gone, wsl is gone from windows. I'm completly screwed.

TW4177 commented 1 year ago

Just lost my entire master's thesis. ... [!]

Horrific. Condolences and hopes for recovery to you, @Vitor-Almeida.

If you can manage it, please reconstruct any environmental details and any "administrative" things that might have gone on on your host PC up to the loss, and post in #9830. Check discussions for any conditions in-common. Thanks!

lamberto15 commented 1 year ago

Got the same problem. Im a bit disappointed with wsl, my project that was not committed to github has been gone. My problem now is how can i explain it to my project manager, 😂😂😂

Failed to attach disk 'C:\Users\lambe\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu22.04LTS_79rhkp1fndgsc\LocalState\ext4.vhdx' to WSL2: The system cannot find the file specified. Error code: Wsl/Service/CreateInstance/MountVhd/ERROR_FILE_NOT_FOUND

corebonts commented 1 year ago

A similar thing happened to me this morning. For me the problem was that it got mounted to the windows itself making it inaccessible for WSL. I could recover it by these steps: 1) Shut down WSL (wsl --shutdown) 2) Open Disk Management (it may ask you to initialize a disk, do not do that!) 3) Find the attached VHD (for me it was a 256G disk with unallocated space) 4) Right click -> detach 5) Start WSL again

I know that it may not be the problem for everyone, but hopefully it helps someone in the future. Also, I don't get why it got mounted to windows.

mrbellek commented 11 months ago

Just posting here to say this happens (and has happened) to me too. Was WFH yesterday, shut down everything normally at end of day, this morning at office, booting up and WSL2 only displays 'Installing, this may take a few minutes'. Everything gone. This has happened at least 5-6 times now, with varying intervals. Sometimes it doesn't happen for months, sometimes twice in a week.

At this point I've gotten a list of commands to run to restore functionality, but I lost quite a lot of uncommited stuff, stashed changes, documentation this way. Seriously considering wiping Windows 10 and fully migrating to Ubuntu on my workstation.

holewa commented 4 months ago

Happened for me today, have been using wsl for two month or so. All my files in /home/username is gone.

ashleyghooper commented 4 months ago

@holewa, that seems like a different issue if you only lost your $HOME. Most people lose their entire WSL virtual disk device.

anistor09 commented 4 months ago

happened for me today as well

carschandler commented 3 months ago

Just happened to me. I have a handful of files from a random project of mine in my home directory, and then various files at root level are also lost, including my entire /nix directory.

I was using VS Code connected to my WSL instance, it was crashing when trying to generate a plot, I restarted it, then I just restarted the distro entirely using wsl -t Ubuntu-22.04 and at some point between these operations, I lost everything.

EDIT: after running wsl --shutdown, my files were restored. But now I am slightly terrified of using WSL.

lschweiss commented 3 months ago

EDIT: after running wsl --shutdown, my files were restored. But now I am slightly terrified of using WSL.

Feel lucky; my files never returned.

I've been following this issue for over a year now. People finding this and reporting they have the same problem is a drumbeat.

If you are fortunate enough to read this thread before losing your files, quit using WSL before it eats yours. Microsoft doesn't care. They close every ticket opened about this problem and never fix or even acknowledge the problem.

joewashek-dmi commented 1 month ago

This happened to me today. Last night shutdown my PC. This morning turn on PC, launch WSL2, the project I was working on in VSCODE is gone. root project folder and everything. gone.