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?
Asked
Active
Viewed 2,534 times
2
dovidweisz
- 193
- 2
- 8
-
Haven't had this scenario, but for safety I'd at least try to delete things through Hyper-V itself rather than the folder. – NotTheDr01ds Aug 25 '21 at 21:41
-
@NotTheDr01ds How would i go about doing that? – dovidweisz Aug 25 '21 at 21:48
-
Can you run "Hyper-V' from the Start Menu? I've never used Docker Desktop with Hyper-V, so not 100% sure. – NotTheDr01ds Aug 25 '21 at 21:55
-
Don’t delete the folder but rather selectively the files belonging to Docker. – Daniel B Aug 26 '21 at 07:16
-
@dovidweisz What Windows version are you running? If you are on Professional or higher, were you able to run the "Hyper-V Manager" from the Start menu? – NotTheDr01ds Aug 26 '21 at 23:14
-
I'm on Windows 10 Enterprise. I need Admin rights to run the "Hyper-V Manager" effectively. I'll get back to this when Desktop-support gets back to me :( – dovidweisz Aug 30 '21 at 15:02
1 Answers
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.
Sathyajith Bhat
- 61,504
- 38
- 179
- 264
-
So is it safe to assume that the Hyper-V location is old and stale data? – dovidweisz Aug 26 '21 at 15:36
-
Agreed that WSL does not use Hyper-V, but the question is whether it is safe to delete data left over from a Docker Desktop installation that used Hyper-V rather than WSL (after switching to WSL). And is the correct way to do it by deleting the folder itself? Or should Hyper-V by used to remove the images? I tend to think that deleting Hyper-V files from outside the manager would result in Hyper-V being in a bad state, but not sure. – NotTheDr01ds Aug 26 '21 at 23:13
-
I updated my answer, @NotTheDr01ds. it's safe to delete if you're not using them. – Sathyajith Bhat Aug 28 '21 at 07:39
-
@SathyajithBhat Thanks - That's what I was saying in the comments on the question itself. It's safer to delete through Hyper-V. And yes, Hyper-V can be enabled alongside WSL2 without any problem, assuming Windows Pro or higher. WSL2 and Hyper-V use the same underlying system at the core, but work together just fine. I just couldn't remember if Docker Desktop using Hyper-V required Pro, but a quick search seems to confirm that it did. So the OP should use Hyper-V Manager to delete the files. – NotTheDr01ds Aug 28 '21 at 13:43