Server 2008 R2 Hyper-V Defragmentation Best Practices
- Hello.
I am looking to see if anyone has any guidance on best practices for defragmenting Hyper-V servers running Server 2008 R2 Datacenter. Should I use the built in defragmentation program? Can I defrag the array that is holding all my VHD files while the VMs are running?
Any guidance on this issue would be appreciated.
Answers
Hi,
If using Fixed Disks, Host-based defragmentation is not needed because the entire VHD is pre-allocated in a contiguous fashion. Guest-based defragmentation would be not different than it is with physical, the built-in utility works fine. However, it may be a useful tool if Dynamically Expanding disks, Differencing disks, or Snapshots are regularly used.
For more information, you can refer to:
Performance Tuning Guidelines for Windows Server 2008
http://www.microsoft.com/whdc/system/sysperf/Perf_tun_srv.mspx
Best Regards,
Vincent Hu
- Marked As Answer byVincent HuMSFT, ModeratorThursday, September 03, 2009 6:03 AM
All Replies
- It is a good idea to do the defragmentation of the host disk before creating vhds. You can turn VMs down then run defrag.exe that is built in for the host disk and run the defrag seperately for each virtual machine.
Hope that helps
Ozan Veranyurt MCITP-MCT http://hyperv.virtualozzy.com (Your step to Virtualization) Please mark as an answer if you feel it is. Hi,
If using Fixed Disks, Host-based defragmentation is not needed because the entire VHD is pre-allocated in a contiguous fashion. Guest-based defragmentation would be not different than it is with physical, the built-in utility works fine. However, it may be a useful tool if Dynamically Expanding disks, Differencing disks, or Snapshots are regularly used.
For more information, you can refer to:
Performance Tuning Guidelines for Windows Server 2008
http://www.microsoft.com/whdc/system/sysperf/Perf_tun_srv.mspx
Best Regards,
Vincent Hu
- Marked As Answer byVincent HuMSFT, ModeratorThursday, September 03, 2009 6:03 AM
Hi,
If using Fixed Disks, Host-based defragmentation is not needed because the entire VHD is pre-allocated in a contiguous fashion...
One technique I find useful, is to defrag a child partition's fixed-size VHD volume by mounting it with VHDMOUNT.vbs to the parent partition (a.k.a. host or root partition), then run defrag explicitly to that volume, then dismount it. This permits an "offline" degragmentation, the best kind in my opinion.
There are various source on the Internet for this mount utility. One source is http://code.msdn.microsoft.com/VHDShellExt, but there are others that work too.
New with Windows Server 2008 R2, is the Disk Management console snap-in (diskmgmt.msc) capability to mount/dismount a VHD for you to/from the parent partition. Just start from the Action menu item and work your way down.
Happy defrag!
Vic- Edited byVictor Lindsey Wednesday, September 02, 2009 4:22 PM- update regarding new R2 feature

