0xC03A001B error while trying to compact VHD

1

What can be the reason of such error? I tried to compact both via DISKPART and Optimize-Vhd commandlet.

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
powershell
hyper-v
vhd
diskpart
asked on Server Fault Dec 5, 2017 by Suncatcher • edited Dec 6, 2017 by Suncatcher

1 Answer

0

Have you checked that the 3rd party tool you're using creates dynamically expanding VHDs? According to this article, compact operation is only supported on dynamically expanding VHDs.

answered on Server Fault Dec 22, 2017 by Bob Hyman

User contributions licensed under CC BY-SA 3.0