What can be the reason of such error? I tried to compact both via DISKPART and
Via DISKPART I get following error:
DISKPART> compact vdisk DiskPart has encountered an error: The requested operation cannot be performed on a virtual disk of this type. See the System Event Log for more information.
Via Hyper-V commandlet I get such exception:
Optimize-Vhd : Failed to compact the virtual disk. The system failed to compact 'd:\boot.vhd'. Failed to compact the virtual disk. The system failed to compact 'd:\boot.vhd': The requested operation cannot be performed on a virtual disk of this type. (0xC03A001B). At line:1 char:1 + Optimize-Vhd -path D:\boot.vhd -Mode Full + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Optimize-VHD], VirtualizationException + FullyQualifiedErrorId : OperationFailed,Microsoft.Vhd.PowerShell.Cmdlets.OptimizeVhd
I reviewed similar questions here (e.g. this) and they are not relevant to me. My VHD is not the VM (it wasn't created by Hyper-V), and I have no file system limitation error.
VHD can be perfectly attached in Disk Management applet, which is weird, 'cause this applet should use the same APIs as PS cmdlets or DISKPART.
P.S. I run Win10 x64 Pro, DiskPart version 10.0.16299.15 and PS version
Major Minor Build Revision ----- ----- ----- -------- 5 1 16299 64