From d59439a3fbd49022f763f215b3883b707f1475b7 Mon Sep 17 00:00:00 2001 From: Tony McDowell Date: Tue, 8 Mar 2022 19:25:15 -0700 Subject: 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 Reviewed-by: Michael Opdenacker Signed-off-by: Richard Purdie --- documentation/dev-manual/start.rst | 41 ++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 11 deletions(-) (limited to 'documentation') diff --git a/documentation/dev-manual/start.rst b/documentation/dev-manual/start.rst index 9c7dde8cf2..701d3cf4dc 100644 --- a/documentation/dev-manual/start.rst +++ b/documentation/dev-manual/start.rst @@ -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="" + DISKPART> attach vdisk readonly + DISKPART> compact vdisk + DISKPART> exit .. note:: -- cgit v1.2.3-54-g00ecf