Link to home
Start Free TrialLog in
Avatar of IT_Fanatic
IT_Fanatic

asked on

Hyper-V VHD Defrag

I have a physical server with Win server 2008 standard R2 installed. I am running Hyper-V with 3 VM's. How do I defrag these VM's? Should I log into the VM and defrag from there? Defrag the VHD if so how? Or defragging VM's is pointless?

I am running dynamically expanding disks.
ASKER CERTIFIED SOLUTION
Avatar of AdrienneSperber
AdrienneSperber
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can use whatever defrag utilities are inside the Guest OS; they won't hurt, as long as you compact the virtual disk afterwards on the Host (quite honestly the size that a dynamic VHD grows to during defrag is NOT significant at all)...

That being said, defragging the Host is absolutely fine... there are actually specialized apps for Hyper-V (like V-Locity) that aid with optimization in virtualized environments.
Avatar of IT_Fanatic
IT_Fanatic

ASKER

SO what is the best way and SAFE way to run maintenance on a VM from Hyper-V? I have a VM that from time to time acts a little so and none responsive.
spaperov you stated "Compacting a VHD does not help with the fragmentation."

Does this mean that even if I compact the fragmentation will still be there? Or if I compact the VHD it will fragment the VM?
Correct, the fragmetation will stay as it is, except for the free space between the blocks of data that will be removed. Compacting does not make the VHD more or less fragmentted.
I compacted the VHD and got my free space back. Ill use defraggler to defrag the VM