Difference between Compact & Shrink in Windows Server 2008 & 2012 versions is, in Win2008( for VHD) it compact’s & shrink if you select Compact option whereas in 2012(for VHDX) we need to shrink if you want to reduce the VHDX size and compact will do only compacts.
- You will get shrink option only for VHDX format files.
- You can run Power shell command to shrink VHD files – This is Good for VHD format files as it compacts and shrinks from command prompt
- Mount-VHD -Path “C:\ClusterStorage\Volume7\Test\test.vhd” -Readonly –> This will mount the VHD (VM need to be turned off)
- Optimize-VHD -Path “C:\ClusterStorage\Volume7\Test\test.vhd” -Mode Quick –> This will do compacts & shrinks
- Dismount-VHD “C:\ClusterStorage\Volume7\Test\test.vhd” –> This will dismount the VHD from Disk Management
Above POST created based on personal experience & knowledge for personal reuse.
In case, if you wish you to use the above article, use the above steps upon proper testing and reader will be responsible for any outcome.