dev-manual: add instructions for compacting WSLv2 VHDX files

Using DiskPart for the systems which lack optimize-vhd

(From yocto-docs rev: c692b77065e6bd8eda789a88fa8fae1351a7274d)

Signed-off-by: Tony McDowell <svet.am@gmail.com>
Reviewed-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Tony McDowell
2022-03-08 19:25:15 -07:00
committed by Richard Purdie
parent 7c617ecb4d
commit d59439a3fb

View File

@@ -502,9 +502,10 @@ your Yocto Project build host:
can be easily avoided by manually optimizing this file often, this
can be done in the following way:
1. *Find the location of your VHDX file:* First you need to find the
distro app package directory, to achieve this open a Windows
Powershell as Administrator and run::
1. *Find the location of your VHDX file:*
First you need to find the distro app package directory, to achieve this
open a Windows Powershell as Administrator and run::
C:\WINDOWS\system32> Get-AppxPackage -Name "*Ubuntu*" | Select PackageFamilyName
PackageFamilyName
@@ -516,22 +517,40 @@ your Yocto Project build host:
replace the PackageFamilyName and your user on the following path
to find your VHDX file::
ls C:\Users\myuser\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79abcdefgh\LocalState\
Mode LastWriteTime Length Name
-a---- 3/14/2020 9:52 PM 57418973184 ext4.vhdx
ls C:\Users\myuser\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79abcdefgh\LocalState\
Mode LastWriteTime Length Name
-a---- 3/14/2020 9:52 PM 57418973184 ext4.vhdx
Your VHDX file path is:
``C:\Users\myuser\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79abcdefgh\LocalState\ext4.vhdx``
2. *Optimize your VHDX file:* Open a Windows Powershell as
Administrator to optimize your VHDX file, shutting down WSL first::
2a. *Optimize your VHDX file using Windows Powershell:*
To use the ``optimize-vhd`` cmdlet below, first install the Hyper-V
option on Windows. Then, open a Windows Powershell as Administrator to
optimize your VHDX file, shutting down WSL first::
C:\WINDOWS\system32> wsl --shutdown
C:\WINDOWS\system32> optimize-vhd -Path C:\Users\myuser\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79abcdefgh\LocalState\ext4.vhdx -Mode full
A progress bar should be shown while optimizing the
VHDX file, and storage should now be reflected correctly on the
Windows Explorer.
A progress bar should be shown while optimizing the
VHDX file, and storage should now be reflected correctly on the
Windows Explorer.
2b. *Optimize your VHDX file using DiskPart:*
The ``optimize-vhd`` cmdlet noted in step 2a above is provided by
Hyper-V. Not all SKUs of Windows can install Hyper-V. As an alternative,
use the DiskPart tool. To start, open a Windows command prompt as
Administrator to optimize your VHDX file, shutting down WSL first::
C:\WINDOWS\system32> wsl --shutdown
C:\WINDOWS\system32> diskpart
DISKPART> select vdisk file="<path_to_VHDX_file>"
DISKPART> attach vdisk readonly
DISKPART> compact vdisk
DISKPART> exit
.. note::