Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uninstalling WSL2 does not remove ext4.vhdx #9683

Closed
1 of 2 tasks
steveklabnik opened this issue Feb 23, 2023 · 6 comments
Closed
1 of 2 tasks

Uninstalling WSL2 does not remove ext4.vhdx #9683

steveklabnik opened this issue Feb 23, 2023 · 6 comments

Comments

@steveklabnik
Copy link

Version

Microsoft Windows [Version 10.0.22621.1105]

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

n/a

Distro Version

Ubuntu

Other Software

No response

Repro Steps

WSL is great. Thank you for all of your hard work on it. I no longer need to use it for a project I'm on, and often have issues with disk space, so I went to go uninstall it to reclaim some space. When I get a new, larger hard drive, I'll probably install it again.

Anyway, on to the actual reproduction:

I removed WSL by following instructions I found. This asks you to use the "uninstall" option in the Installed Apps section of my Settings. I uninstalled both "Ubuntu on Windows" as well as "Windows Subsystem for Linux"

Expected Behavior

WSL is completely uninstalled.

Actual Behavior

While everything seemed to be uninstalled, I am still running quite low on hard rive space. After using a tool to determine what was taking up the most space on my hard drive, I found this file still exists:

C:\Users\steve\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc\LocalState\ext4.vhdx

My understanding is that this is the virtual hard drive, if you will, for my previous install. It's 96.2gb, which is almost 10% of my hard drive. I would have assumed that uninstalling would completely remove files from my filesystem, especially one this large. However, I also can see the utility of this lying around, in case I wanted my old files when I reinstalled, so I would maybe expect a question, asking me if I'd like to clear it up or not.

Diagnostic Logs

No response

@elsaco
Copy link

elsaco commented Feb 23, 2023

@steveklabnik if you want to remove the vhdx use wsl --unregistser <distro_name>. This will delete your distro's virtual driver but not the appx package which remains available and not downloaded again if you later run wsl --install -d <distor_name>.

@benhillis
Copy link
Member

Deleting the CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc application will delete the VHD. It's possible the vhd was in use when you uninstalled the app, but it should be removed when you next reboot your machine.

@steveklabnik
Copy link
Author

when you next reboot your machine.

Ahh, maybe this is it; I only reboot when an update requires me to.

Anyway, thanks folks!

@gajiki
Copy link

gajiki commented Oct 12, 2023

I just ran into this problem. I have ran wsl --unregistser <distro_name> and uninstalled both Ubuntu and Windows Subsystem for Linux. I have restarted twice, and still the ext4.vhdx file is camping out in my AppData. Linux appears to still be mounting somehow, but the drive is empty. Am I missing something?

Edit: Just disabled the "Windows Subsystem for Linux" Windows feature, restarted, and the Linux drive is now gone. However, ext4.vhdx is still in AppData taking up 100GB.

@mklueh
Copy link

mklueh commented Feb 7, 2024

I've uninstalled it first, then ran wsl --unregister Ubuntu 20.04 and with that command the vhdx file was gone. Thanks for the hint

@running-machin
Copy link

I just ran into this problem. I have ran wsl --unregistser <distro_name> and uninstalled both Ubuntu and Windows Subsystem for Linux. I have restarted twice, and still the ext4.vhdx file is camping out in my AppData. Linux appears to still be mounting somehow, but the drive is empty. Am I missing something?

Edit: Just disabled the "Windows Subsystem for Linux" Windows feature, restarted, and the Linux drive is now gone. However, ext4.vhdx is still in AppData taking up 100GB.

how did you deal with this issue. I am facing similar issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants