

This GUI tool is written in C++ and majorly focuses on removing unnecessary files and cache of the system. With this Self-elevate script you can compact multiple vhdx at once. Stacer is a fantastic tool that can optimize your storage by managing the different aspects of your operating system. I have tested and confirmed both the second and third techniques personally.
UBUNTU CLEAN DISK SPACE FREE
Note that you will need to reset the default username after an import. Space On Windows Analyze Your Disk Usage, , linux-headers, and linux- packages., This article will list a few methods that can be used to free up disk space. On Windows Home (and higher) you can use diskpart as described in this comment.Įxporting the WSL distro and re-importing it into a new WSL instance (as in this comment) will also reclaim the space.

UBUNTU CLEAN DISK SPACE INSTALL
If you are on Windows Professional or higher, you can install Hyper-V and use the Optimize-VHD commandlet as described in the original issue. If you are running Docker Desktop, also shut it down, otherwise it may inadvertently attempt to restart WSL after your -shutdown. This command summarizes the space usage for a specified directory or the current directory if none is specified. Delete all unused old kernels, run: sudo apt -purge autoremove. Note down system disk space usage by running the df -H command. List all other older kernel using the dpkg command. I recommend you start with a wsl -shutdown and copy the vhdx as a backup to start. Use the du command to analyze disk space at a more granular level. The procedure to delete all unused old kernels on Ubuntu Linux version 18.04 and 20.04 LTS is as follows: First, boot into a new kernel.
UBUNTU CLEAN DISK SPACE SOFTWARE
Or, if you want to do the same without a command line, use the Ubuntu Software manager, where you’ll only need to click the 'Remove' button. Then there are several techniques that you can use to remove the unused space. Uninstall the application with the following command: sudo apt remove application name. sudo update-initramfs -d -k 4.2.0-15-generic. For a default Ubuntu installation, it should be in something like %PROFILE%\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\ To free space in /boot well remove an initrd.img file for a suitable old kernel manually, this is necessary due to a kenel packaging bug. The first thing you'll need to do is know the location of your ext4.vhdx. WSL will automatically grow the virtual disk (ext4.vhdx), but shrinking it to reclaim unused space is something that must currently be done manually. Ubuntu includes (or used to include, anyway-if it doesnt anymore, you can install it with Software Center) a disk usage analyzer called baobab that may be helpful to you. There's a WSL Github issue open on this topic. Also check /var/log for bloated log files you dont need, remove old kernel updates, etc.
