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.
Windows Server 2008Virtualization

Avatar of undefined
Last Comment
IT_Fanatic

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
AdrienneSperber

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Svet Paperov

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Jornak

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.
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.
emadallan

Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
IT_Fanatic

ASKER
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?
Svet Paperov

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.
IT_Fanatic

ASKER
I compacted the VHD and got my free space back. Ill use defraggler to defrag the VM
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.