New
#1
Compacting virtual hard disks
Compressing a vhdx file in Hyper-V
Well I have had fun today trying to compress some vhdx files used in Hyper-V.
My VHDXs only had around 15GB of files (10 pro Insider 15061) including hidden files after disk cleanup when in Hyper-V but the vhdx files were around 40 GB/
Tried following
1) to compact it using Hyper-V compact - no change
2) mounted vhdx as drive in host and used vdisk compact - no change
3) backed up vhdx using Macrium Reflect, deleted partition and restored - no change.
4) shrunk c drive to minimum size with partition wizard - no change
5) shrunk c drive to minimum size and expanded to full size with partition wizard - no change
6) backed up c partition from 5 above (deleting c partition in vhd in Macrium) and restored with Macrium - no change
So I did this then
7) deleted c drive partition in vhdx from disk management, and then restored c drive using Macrium (said full copying)- no change!
8) So I then created a new vhdx and restored the image backup to new vhd (Hoooray - file now only 15 GB)
9) renamed old vhdx with .bak and renamed new one to old name and ran hyper-v - would not boot.
Back to trusty Macrium - booted from Rescue Drive and used "fix windows boot problems" - SUCCESS!
So sequence is
a) mount vhdx in hyper-v, use disk cleanup etc.
b) mount vhdx in host disk management
c) shrink c drive to minimum, the re-expand to full size using minitool partition wizard or similar
d) image backup vhdx using Macrium Reflect
e) create new vhdx
f) restore image backup from Macrium Reflect to new one (renaming old to .bak and new name to old name).
g) repair boot files using Macrium in hyper-v if needed.
In hindsight, not sure if step c is needed. More testing needed.