The status of the previously created ubuntu folders in windows linux s

AI Thread Summary
The discussion revolves around the status of files created in WSL1 after upgrading to WSL2 and uninstalling the Ubuntu app. Users share experiences about encountering errors due to BIOS virtualization settings and the steps taken to uninstall WSL2, which include deleting the Ubuntu app and clearing Windows Features. It is clarified that if the uninstallation is done properly, it will remove the entire folder containing the WSL installation, including user files stored in the virtual hard disk. However, remnants of previous installations may remain, leading to uncertainty about file deletion. Ultimately, users are advised to check for the presence of the ext4.vhdx file to confirm whether their data has been deleted.
Arman777
Insights Author
Gold Member
Messages
2,163
Reaction score
191
A couple of months ago, I had created a WSL1 and used the Ubuntu app under the username void Later on, I have decided to upgrade it to WSL2, but I have encountered an error while upgrading it. Later on, I have discovered that it was due to BIOS virtualization settings.

In any case, I have performed these operations to delete the WSL2.

https://pureinfotech.com/uninstall-wsl2-windows-10/

1) Delete Ubuntu App
2) Uninstall Windows Subsystem for Linux update
3) Clear the Virtual Machine Platform option from the Windows Features
4) Clear the Windows Subsystem for Linux option from the Windows Features

After these operations, I enabled the BIOS virtualization and downloaded the WSL2 again, which runs perfectly fine.

The problem is I wonder what happened to the files that I have created under WSL1 under the void username. Are they also deleted after doing the above operations, or are they just somewhere in my windows machine.

Similar second question:

If I delete my ubuntu app (from windows store), does that also delete all my data (folders, etc.) that I have created under that username?
 
Technology news on Phys.org
It's complicated.

WSL files are stored under %USERPROFILE%\AppData\Local\Packages\[distro name].

In practice this means your new Ubuntu subsystem files will be somewhere like
Code:
C:\Users\Arman777\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc
which I will shorten to [wslpath].

there is a file [wslpath]\LocalState\ext4.vhdx which is a virtual hard disk file containing your Linux filesystem. This will usually be mounted in Windows and can be accessed in Windows Explorer under Linux -> Ubuntu (this usually appears right at the bottom of the left hand pane).

User files are stored under /home, in this case /home/void.

Now this is very important: there is no correspondence between WSL installations and linux user names. You can have many different WSL installs, even separate different Ubuntu WSL installations and the user names and associatied /home folders are entirely separate.

So if you are lucky and you didn't uninstall the old WSL instance properly, you might find the files still sitting there under Linux in the Explorer tree. Or perhaps you might find the virtual disk image under the path at the top of this post (or even in a backup) and be able to mount it to extract the files you want.
 
  • Like
Likes sysprog and Arman777
Arman777 said:
If I delete my ubuntu app (from windows store), does that also delete all my data (folders, etc.) that I have created under that username?
If the uninstallation works properly it will delete the whole folder containing that WSL installation including the virtual hard disk file which contains the image of the linux filesystem which contains the /home folder which contains the /home/[username] subfolder which contains your user files.
 
  • Like
Likes sysprog and Arman777
pbuk said:
So if you are lucky and you didn't uninstall the old WSL instance properly,
well I only performed the above steps.
pbuk said:
you might find the files still sitting there under Linux in the Explorer tree. Or perhaps you might find the virtual disk image under the path at the top of this post (or even in a backup) and be able to mount it to extract the files you want.
I actually want to make sure that those files are deleted.
pbuk said:
If the uninstallation works properly it will delete the whole folder containing that WSL installation including the virtual hard disk file which contains the image of the linux filesystem which contains the /home folder which contains the /home/[username] subfolder which contains your user files.
What do you mean by "works properly" ? You can either delete it or not, isn't it ?

btw thanks for the answer.
 
To run WSL2, I have downloaded and deleted many ubuntu apps and created a couple of users. It's silly, but I was curious about the status of those files and some of the folders that I made during those times.
pbuk said:
Now this is very important: there is no correspondence between WSL installations and linux user names. You can have many different WSL installs, even separate different Ubuntu WSL installations and the user names and associatied /home folders are entirely separate.
That makes sense. I can also download Kali, for instance, or maybe create a new account inside Ubuntu.

pbuk said:
If the uninstallation works properly it will delete the whole folder containing that WSL installation including the virtual hard disk file which contains the image of the linux filesystem which contains the /home folder which contains the /home/[username] subfolder which contains your user files.
If that's the case then I have nothing to worry.
 
Arman777 said:
What do you mean by "works properly" ?
Doesn't e.g. suffer a power off, disk failure or user abort before it is complete.
Arman777 said:
I actually want to make sure that those files are deleted.
If you make sure there is one and only one ext4.vhdx file under your C:\Users\Arman777\AppData\Local\... folder you should be OK.
 
  • Like
Likes sysprog and Arman777
pbuk said:
Doesn't e.g. suffer a power off, disk failure or user abort before it is complete.

If you make sure there is one and only one ext4.vhdx file under your C:\Users\Arman777\AppData\Local\... folder you should be OK.
In this folder

Code:
C:\Users\Arman\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState

theres only one ext4.vhdx file. So I think I am okay. Good to know this info :)
 
Arman777 said:
So I think I am okay.
Yes, as long as there isn't a .vhdx file under e.g.
Code:
...\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState
as well (I have this folder on my HD left over from a previous Ubuntu WSL installation, but it is empty which is OK).
 
pbuk said:
Yes, as long as there isn't a .vhdx file under e.g.
Code:
...\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState
as well (I have this folder on my HD left over from a previous Ubuntu WSL installation, but it is empty which is OK).
Thats the same path that I have shared.. ?
 
  • #10
Arman777 said:
Thats the same path that I have shared.. ?
No, yours had Ubuntu20.04onWindows instead of UbuntuonWindows :-p
 
  • Like
Likes Arman777
  • #11
pbuk said:
No, yours had Ubuntu20.04onWindows instead of UbuntuonWindows :-p
There are 3 versions of Ubuntu;
Ubuntu
Ubuntu 20.04
Ubunutu 18.04
I have only Ubuntu 20.04 downloaded...so I don't have UbuntuonWindows folder...
 
  • #12
Arman777 said:
I have only Ubuntu 20.04 downloaded...
Me too...
Arman777 said:
...so I don't have UbuntuonWindows folder...
...but I do have a UbuntuonWindows folder left over from a previous install - when I uninstalled it, it only deleted the files but left the folder structure. You can never be sure with Windows!

Oh and guess what: I re-installed the App 'Ubuntu' just now and it installed 20.04, so I now have 20.04 under UbuntuonWindows and 20.04.03 under Ubuntu20.04onWindows. Yes really! (lsb_release -a).
 
  • Like
Likes Arman777
  • #13
Oh and guess what: I uninstalled that 20.04 version and it left the vhd file behind (probably because I had it mounted and forgot to close it).

All this weirdness is why I stressed above that you cannot assume that a Windows uninstall has done everything you think it should do (and don't get me started on the Registry).
 
  • #14
pbuk said:
Me too...

...but I do have a UbuntuonWindows folder left over from a previous install - when I uninstalled it, it only deleted the files but left the folder structure. You can never be sure with Windows!

Oh and guess what: I re-installed the App 'Ubuntu' just now and it installed 20.04, so I now have 20.04 under UbuntuonWindows and 20.04.03 under Ubuntu20.04onWindows. Yes really! (lsb_release -a).
lol
pbuk said:
Oh and guess what: I uninstalled that 20.04 version and it left the vhd file behind (probably because I had it mounted and forgot to close it).
thats possible I guess. Yes windows sometimes acts weird..
 
Back
Top