Hello. I was wondering how much disk space the entire Linux subsystem installation uses, can anyone give an estimated number? Thank you! Once the files were downloaded and unzipped and the initial setup was complete, I measured the storage space again. To optimize space, you need to defragment the image and then write zeros (0x00) to the empty space – this is the format of VHDX files (not WSL2). The size of my “lxss” folder (where the Linux subsystem is located) is ~800 MB (~850 MB on disk). I installed gedit, but otherwise no other Linux program was installed. I think the gedit takes up almost no space, so I imagine it`s pretty close to the size of the full vanilla installation. I think you really want an experience as close as possible to WSL1, but of course with the incredible pros and benefits. That is, the WSL2 file system should not look like a static volume bound to a file on the host (although it does). Ideally, even the size of the WSL partition/volume should decrease and grow in a timely manner with the available space on the host. Now there is an ambitious goal for you! If you`re looking for a way to reclaim your storage from Docker using WSL2, there`s a button for this if you`re using Desktop Docker (Edge 2.3.0.0). In the dashboard/troubleshoot, there is a Clean/Clean Data option that allows you to choose what you want to delete.
The Docker VHDX disk file has been safely reduced to a few kilobytes. Just a warning that this obviously removes everything and not just unused space. I would also like to see a setting for the initial partition size limit. It seems that all distributions with a partition size of 250 GB are installed. I don`t see an (easy) way to extend this. My Yocto builds take up a little more space and they have to be on an ext3/4 partition, so I can`t use the /mnt/c or other NTFS partitions. After that, I see in the Ubuntu command prompt that the allocated space is 250GB. I don`t see this 250GB allocation anywhere in Windows. He said before that I had 317GB free, and he still says it after a few reboots.
Is Windows now secretly hiding 250GB from me because it was allocated to WSL? Do I really only have 67 GB free? Thank you I`m also not 100% sure if in the WSL only the “free” space is compressed, which was once used but is no longer used, or if it does more. How can I work around this error? This left my SSD at a dangerously low storage level and I don`t want to reinstall the entire WSL 2 instance from scratch and reconfigure Docker every time I accidentally copy an unused file to WSL 2`s file system. Thank you Stephen. I followed your instructions and managed to free up about 6GB of disk space. At this point, my drive has almost no space and I can`t find anything on Google to compress it except to destroy the entire WSL 2 instance and build it from scratch. The virtual disk used by WSL2 (ext4.vhdx) is called a sparse disk. In other words, it appears to the underlying operating system as its maximum available size, but it only takes up the space it needs on the host disk (Windows). Update: I also have a 2. Recorded video focusing on reclaiming a ton of storage space from Docker Desktops` WSL 2 VM. I recommend watching this video after this video. Long story short, I saved a backup to the wrong directory and my WSL2 disk was extended to occupy all the available space on my disk. I was looking for a way to shrink a WSL2 virtual disk, and after a few fake boots, I found a method that worked for me.
Hope this helps you too! (You can also use the zerofree utility to free up empty space (instead of the e2fsck utility) – to do this, remove “rem”) If you check your VHDX now, you should see that it has been reduced. It depends on the amount of white space used by WSL2, the reduction of space. In my case, this was pretty important: as of July 2020, it`s easy to find yourself in a situation where WSL 2 consumes all your storage space, uses 80% of your storage, and gets poor file I/O performance when accessing mounted disks. Thank you, it worked for me and reduced a hard drive from 250GB to 150GB. WSL reports 75GB as “in use” (according to df -h), which is why I thought it might shrink even smaller, but 100GB of extra space is better than nothing 🙂 The WSL 2 VHD uses the ext4 file system. The size of this VHD automatically adapts to your storage needs and has an initial maximum size of 256 GB.