diff options
author | Tony McDowell <svet.am@gmail.com> | 2022-03-08 19:25:15 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-03-16 14:25:01 +0000 |
commit | d59439a3fbd49022f763f215b3883b707f1475b7 (patch) | |
tree | 772f8cb944dd19a1f168d766b0a8f3a7bbd5d6fc /documentation | |
parent | 7c617ecb4d161fc98033534b45c05072cba5647a (diff) | |
download | poky-d59439a3fbd49022f763f215b3883b707f1475b7.tar.gz |
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>
Diffstat (limited to 'documentation')
-rw-r--r-- | documentation/dev-manual/start.rst | 41 |
1 files changed, 30 insertions, 11 deletions
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: | |||
502 | can be easily avoided by manually optimizing this file often, this | 502 | can be easily avoided by manually optimizing this file often, this |
503 | can be done in the following way: | 503 | can be done in the following way: |
504 | 504 | ||
505 | 1. *Find the location of your VHDX file:* First you need to find the | 505 | 1. *Find the location of your VHDX file:* |
506 | distro app package directory, to achieve this open a Windows | 506 | |
507 | Powershell as Administrator and run:: | 507 | First you need to find the distro app package directory, to achieve this |
508 | open a Windows Powershell as Administrator and run:: | ||
508 | 509 | ||
509 | C:\WINDOWS\system32> Get-AppxPackage -Name "*Ubuntu*" | Select PackageFamilyName | 510 | C:\WINDOWS\system32> Get-AppxPackage -Name "*Ubuntu*" | Select PackageFamilyName |
510 | PackageFamilyName | 511 | PackageFamilyName |
@@ -516,22 +517,40 @@ your Yocto Project build host: | |||
516 | replace the PackageFamilyName and your user on the following path | 517 | replace the PackageFamilyName and your user on the following path |
517 | to find your VHDX file:: | 518 | to find your VHDX file:: |
518 | 519 | ||
519 | ls C:\Users\myuser\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79abcdefgh\LocalState\ | 520 | ls C:\Users\myuser\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79abcdefgh\LocalState\ |
520 | Mode LastWriteTime Length Name | 521 | Mode LastWriteTime Length Name |
521 | -a---- 3/14/2020 9:52 PM 57418973184 ext4.vhdx | 522 | -a---- 3/14/2020 9:52 PM 57418973184 ext4.vhdx |
522 | 523 | ||
523 | Your VHDX file path is: | 524 | Your VHDX file path is: |
524 | ``C:\Users\myuser\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79abcdefgh\LocalState\ext4.vhdx`` | 525 | ``C:\Users\myuser\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79abcdefgh\LocalState\ext4.vhdx`` |
525 | 526 | ||
526 | 2. *Optimize your VHDX file:* Open a Windows Powershell as | 527 | 2a. *Optimize your VHDX file using Windows Powershell:* |
527 | Administrator to optimize your VHDX file, shutting down WSL first:: | 528 | |
529 | To use the ``optimize-vhd`` cmdlet below, first install the Hyper-V | ||
530 | option on Windows. Then, open a Windows Powershell as Administrator to | ||
531 | optimize your VHDX file, shutting down WSL first:: | ||
528 | 532 | ||
529 | C:\WINDOWS\system32> wsl --shutdown | 533 | C:\WINDOWS\system32> wsl --shutdown |
530 | C:\WINDOWS\system32> optimize-vhd -Path C:\Users\myuser\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79abcdefgh\LocalState\ext4.vhdx -Mode full | 534 | C:\WINDOWS\system32> optimize-vhd -Path C:\Users\myuser\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79abcdefgh\LocalState\ext4.vhdx -Mode full |
531 | 535 | ||
532 | A progress bar should be shown while optimizing the | 536 | A progress bar should be shown while optimizing the |
533 | VHDX file, and storage should now be reflected correctly on the | 537 | VHDX file, and storage should now be reflected correctly on the |
534 | Windows Explorer. | 538 | Windows Explorer. |
539 | |||
540 | 2b. *Optimize your VHDX file using DiskPart:* | ||
541 | |||
542 | The ``optimize-vhd`` cmdlet noted in step 2a above is provided by | ||
543 | Hyper-V. Not all SKUs of Windows can install Hyper-V. As an alternative, | ||
544 | use the DiskPart tool. To start, open a Windows command prompt as | ||
545 | Administrator to optimize your VHDX file, shutting down WSL first:: | ||
546 | |||
547 | C:\WINDOWS\system32> wsl --shutdown | ||
548 | C:\WINDOWS\system32> diskpart | ||
549 | |||
550 | DISKPART> select vdisk file="<path_to_VHDX_file>" | ||
551 | DISKPART> attach vdisk readonly | ||
552 | DISKPART> compact vdisk | ||
553 | DISKPART> exit | ||
535 | 554 | ||
536 | .. note:: | 555 | .. note:: |
537 | 556 | ||