I switched Docker over to WSL2 Is it safe to delete my Hyper-V folder?

I recently switched over from the legacy Docker desktop for windows(Hyper-V) to the WSL 2 based version. I am running out of space on my hard drive and noticed a folder at C:\Users\Public\Documents\Hyper-V that is very large (> 80 GB). Is it safe to remove that?


Solution 1:

WSL doesn't use the HyperV location to save data. You can verify this by typing the below command in PowerShell as mentioned here

(Get-ChildItem HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss | ForEach-Object {Get-ItemProperty $_.PSPath}) | select DistributionName, @{n="Path";e={$_.BasePath + "\rootfs"}}

This should print out where the data for your WSL2 distro is saved on the drive. Once you've verified it doesn't point to the Hyper-V directory, you can delete it off.


It is fine to delete them by hand, if you're never going to use them. Removing the VM in Hyper V manager should also delete the VHDs, which is the safer way, but I can't recall if WSL2 install requires disabling Hyper-V, which means you can't use Hyper-V manager. If you can use Hyper-V manager by installing it from Windows features, by all means install and remove the images using that.