WSL 2 Ubuntu Files Gone after changing my window username #7026
Replies: 7 comments 2 replies
-
Same situation, bro |
Beta Was this translation helpful? Give feedback.
-
@Nennori While it's almost certainly too late for the OP to still be worried about this, there's a chance you can still recover. Simply renaming the folder shouldn't remove the files. However, doing a Windows Restore (which the OP did) could easily delete them. As noted in one of the answers on that Super User question:
The location of every WSL distribution is stored in registry keys, so if your user profile folder name changed, those will now be wrong. Try going to PowerShell and run:
This will list the location(s) where WSL thinks the distribution(s) are. Let's say you see:
If you go to the equivalent folder in the newly renamed profile ... E.g.:
Do you find the files there? Of course, you'll need to use the output from the command above to find the correct folder - My example above is only valid for my install. |
Beta Was this translation helpful? Give feedback.
-
Most likely, yes. As long as the files are still there, you're in reasonably good shape. First, do not under any circumstance reinstall Ubuntu 18.04 from the Store. Doing that would almost certainly overwrite the old files. Next, was the 18.04 distribution WSL1 or WSL2? If you find WSL1 may be trickier. At the worst case, you can at least copy any individual, critical files you need out of a WSL1 directory. Permissions and ownership will be lost, but the content/data should be intact. Either way, if you have the space available, I'd probably make a copy of that folder to a safe location to start with.
|
Beta Was this translation helpful? Give feedback.
-
@NotTheDr01ds, unfortunately, I've already reinstalled Ubuntu18.04 and it was saved in folder besides old Ubuntu18.04 directory |
Beta Was this translation helpful? Give feedback.
-
@Nennori Any external storage (USB flash drive, etc.?) you can move it to for backup? You can try the PowerShell |
Beta Was this translation helpful? Give feedback.
-
After renaming the user folder. I also encountered exactly the same problem. I made it work by doing the following:
|
Beta Was this translation helpful? Give feedback.
-
I have similar problem, not after changing username, but after reboot (!).
I've checked this |
Beta Was this translation helpful? Give feedback.
-
Windows Build Number
Microsoft Windows [Version 10.0.19041.985]
WSL Version
Kernel Version
No response
Distro Version
Ubuntu 18.04
Other Software
No response
Repro Steps
Expected Behavior
I was expecting to see, my WSL data is still there. I didn't expect that all the data is deleted because I changed my window username and folder name.
Actual Behavior
It's gone! all gone! All data are deleted. I can't restore it. I hoped that there would be a way to change path connecting with WSL. How is it possible to be deleted all without alert?
Diagnostic Logs
No response
Beta Was this translation helpful? Give feedback.
All reactions