1

I have a server running a number of Hyper-V guest instances. One recommendation to improve the performance of our guest OSes is to defragment the vhd files. Can I do this while the guest is still running? Is there a way to defragment only a single file?

1
  • I found the (formerly) SysInternals Contig utility to defragment single files. It dosn't seem to work with open files. But I still have a question about the Windows Defragment utility in Server 2008. Oct 23, 2010 at 16:25

1 Answer 1

1

There is a way to defragment only a single file - Contig from SysInternals:

http://technet.microsoft.com/en-us/sysinternals/bb897428.aspx

I don't know that you can do it while the files are in use, I'd guess not but am willing to be surprised.

But I'm a bit skeptical that it will do much good unless they are severely fragmented (contig will tell you how many fragments they are in) - especially if you're using modern hard disks which abstract away where they are writing so they can rewrite to avoid errors, a RAID disk system with a controller that has disk cache, with OS disk cache.

And the files within the virtual machines can be fragmented as well so it wont be accessing contiguous parts of the VHD necessarily. And if Hyper-V is anything like VMWare, it has it's own disk handling which merged multiple reads/writes from the VMs into fewer read/writes for the real disks.

Summary: don't expect miraculous speedups unless you've been adding and removing different size virtual machines over and over for ages.

1
  • Defragmenting a VHD is also quite effective if you've been making use of snapshots and have recently merged the changes. Oct 23, 2010 at 16:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .