Description
Is your feature request related to a problem? Please describe.
It is currently impossible to limit the size of a vhdx when installing a WSL instance. Now that it default to a maximum size of 1TB, it is incredibly easy for an image to eat up all the HD space on the host. Luckily in my case the vdisk had already been moved away from the C:\
I'm actually incredulous that anyone thinks that 1TB is a reasonable default maximum size for a WSL image.
Describe the solution you'd like
A flag that sets the maximum possible size of the virtual disk. Even better, allow us to set a default maximum size for all WSL instances.
Describe alternatives you've considered
An insanely manual process.
- Stop the distro and make sure the vdisk isn't in use. (I actually had to reboot - welcome back to the 1990s)
- Create a new distro, and mount the vdisk using
--bare
- Use
resize2fs
to shrink the drive - Unmount the vdisk and unregister the new distro (I don't need another one eating another TB)
- Restart the original disto
The vhdx still has a maximum size of 1TB but at least the instance can't use that much.
Additional context
For some reason the Ubuntu image spammed the kern.log and syslogs so they ended up being 450GB each. Even after I deleted the logs, I couldn't compact (using either resize-vdisk or diskpart) the vhdx as it was stored in an encrypted folder.
My only option was to delete it and start from scratch which wasted a couple of hours of my time.