我启用了WSL2。我正在尝试使用
收缩Docker磁盘Optimize-VHD -Path $Env:LOCALAPPDATADockerwsldataext4.vhdx -Mode Full
但是我得到错误:
Optimize-VHD : Hyper-V encountered an error trying to access an object on computer 'XXXXX' because the object was not
found. The object might have been deleted. Verify that the Virtual Machine Management service on the computer is runnin
g.
At line:1 char:1
+ Optimize-VHD -Path .ext4.vhdx -Mode Full
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (:) [Optimize-VHD], VirtualizationException
+ FullyQualifiedErrorId : ObjectNotFound,Microsoft.Vhd.PowerShell.Cmdlets.OptimizeVhd
需要重建Windows vm文件。以admin权限运行:
mofcomp.exe %SYSTEMROOT%System32WindowsVirtualization.V2.mof