<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.its-treason.com/index.php?action=history&amp;feed=atom&amp;title=WSL2</id>
	<title>WSL2 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.its-treason.com/index.php?action=history&amp;feed=atom&amp;title=WSL2"/>
	<link rel="alternate" type="text/html" href="https://wiki.its-treason.com/index.php?title=WSL2&amp;action=history"/>
	<updated>2026-06-12T15:33:32Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://wiki.its-treason.com/index.php?title=WSL2&amp;diff=44&amp;oldid=prev</id>
		<title>Timon: Created page with &quot;== Reclaiming disk space == All data of WSL2 Distros and Docker is stored in &lt;code&gt;.vhdx&lt;/code&gt; files under the current user&#039;s “AppData” directory. The problem is that the virtual hard disk files size will not shrink when disk space in freed on the WSL2 distro. This issue has already been discussed on GitHub: https://github.com/microsoft/WSL/issues/4699 but currently the only solution is to manually optimize the virtual hard disk to reclaim disk space.  === Locating...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.its-treason.com/index.php?title=WSL2&amp;diff=44&amp;oldid=prev"/>
		<updated>2023-05-31T12:47:46Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Reclaiming disk space == All data of WSL2 Distros and Docker is stored in &amp;lt;code&amp;gt;.vhdx&amp;lt;/code&amp;gt; files under the current user&amp;#039;s “AppData” directory. The problem is that the virtual hard disk files size will not shrink when disk space in freed on the WSL2 distro. This issue has already been discussed on GitHub: https://github.com/microsoft/WSL/issues/4699 but currently the only solution is to manually optimize the virtual hard disk to reclaim disk space.  === Locating...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Reclaiming disk space ==&lt;br /&gt;
All data of WSL2 Distros and Docker is stored in &amp;lt;code&amp;gt;.vhdx&amp;lt;/code&amp;gt; files under the current user&amp;#039;s “AppData” directory. The problem is that the virtual hard disk files size will not shrink when disk space in freed on the WSL2 distro. This issue has already been discussed on GitHub: https://github.com/microsoft/WSL/issues/4699 but currently the only solution is to manually optimize the virtual hard disk to reclaim disk space.&lt;br /&gt;
&lt;br /&gt;
=== Locating the virtual hard disk files ===&lt;br /&gt;
[[File:Windirstat virtual disk wsl2.png|thumb|Example with “DinDirStat” the two virtual hard disks are clearly visible in purple.]]&lt;br /&gt;
The easiest way to locate them is to use “WinDirStat” it will show the files clearly and allows copying and pasting the path.&lt;br /&gt;
&lt;br /&gt;
Without “WinDirStat” the files can be found under &amp;lt;code&amp;gt;C:\Users\&amp;lt;User&amp;gt;\AppData\Local\Docker\wsl\data\ext4.vhdx&amp;lt;/code&amp;gt; for docker and &amp;lt;code&amp;gt;C:\Users\&amp;lt;User&amp;gt;\AppData\Local\Packages\&amp;lt;Distro&amp;gt;\LocalState\ext4.vhdx&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Reclaiming space ===&lt;br /&gt;
First, be sure to shut down all WSL2 distros by running &amp;lt;code&amp;gt;wsl --shutdown&amp;lt;/code&amp;gt; inside a PowerShell. After that, executing &amp;lt;code&amp;gt;wsl --list --running&amp;lt;/code&amp;gt; should print out &amp;lt;code&amp;gt;There are no running distributions.&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
After shutting down all WSL2 distros, you can run &amp;lt;code&amp;gt;optimize-vhd -Path &amp;lt;Path&amp;gt; -Mode full&amp;lt;/code&amp;gt; in a PowerShell with administrator privileges. The optimization process will take a few minutes to complete.&lt;/div&gt;</summary>
		<author><name>Timon</name></author>
	</entry>
</feed>