4

In operation of a virtual Vmware or Hyper-V guest typically advice is given to defrag the host and virtual disk images so to result in improved performance.

Something like a cmd: vmware-vdiskmanager -d <file.vmdk> works great.

Yet I can't find any qualitive evidence that suggest defraging inside the guest VM improves performance. Does anyone have advice or evidence that doesn't come from a commercial defragger's whitepaper that suggests inside guest defragging helps?

Mark Henderson
  • 68,316
  • 31
  • 175
  • 255
jafin
  • 335
  • 1
  • 5
  • 12

4 Answers4

4

It depends on the performance of your storage and the performance of your application. The challenge with current virtualization hosts is that each guest can only get 1 host bus adapter (HBA) of throughput to any given LUN. (The only exception to this is the latest VMware vSphere v4.0 - the very top level of licensing gets you the chance to run EMC's multipathing software.) So, if your throughput bottleneck is a single HBA even when no other guests are using the storage, fragmentation isn't usually going to be the weakest link in the virtual chain.

Plus, toss in the fact that several virtual guests usually share the same SAN lun anyway. If three servers are accessing their drives simultaneously, and they all share the same physical array, then all access is essentially random.

The only time I'd look at defragmenting virtual disks is if each guest had its own dedicated SAN array, and if HBA throughput wasn't a bottleneck.

Brent Ozar
  • 4,425
  • 17
  • 21
  • +1 for solidness. Got any links to docs by chance? – SQLChicken Jun 02 '09 at 13:26
  • No, because part of the VMware licensing agreement is that you're not allowed to publish benchmarks w/o their approval. – Brent Ozar Jun 02 '09 at 13:47
  • 1
    "because part of the VMware licensing agreement is that you're not allowed to publish benchmarks w/o their approval. " That absolutely cannot be legal. I wish there were criminal penalties for organizations that establish contracts that are blatantly unenforcable. – Chris Marisic Jan 07 '11 at 14:06
1

My understanding is that the vdisk file is a file that acts like a physical disk. So I think the question is, does vdiskmanager actually understand the filesystem that lives on this disk. I think that that it does not, and that is why defragmenting within the OS should help.

Kyle Brandt
  • 82,107
  • 71
  • 302
  • 444
  • Conversely though, the VM does not know how the data is stored within the physical drive or SAN that backs it. – Dan Carley Jun 02 '09 at 13:30
1

Since you mention vmware and hyper-v guests I'll presume you're not running ESX versions of vmware, and are using more of a hosted model. Defragging the host OS is a good idea.

Defragging inside the guest though can be bad. I only have experience with vmware's products, not hyper-v, but if you have a guest with snapshots, defragging can cause you to use a large amount of disk space.

A snapshot is a delta of the changes made from the parent disk file. When you update a block in the guest, the size of the delta increases. If defragmenting touches every block, your snapshot would increase in size to consume the same amount of disk space as your original virtual hard drive. Just something to be aware of.

Sage
  • 111
  • 2
0

Brent's answer is certainly sensible. I came across several links while researching this topic this morning that recommend you should defrag the VM like you would a physical server.

http://itknowledgeexchange.techtarget.com/virtualization-pro/defragmenting-virtual-machine-disk-files/

http://www.vmware.com/support/gsx3/doc/disks_defrag_shrink_gsx.html

http://www.dciginc.com/2008/10/the-physical-challenges-of-disk-defragmentati.html

If we assume that there are multiple VMs accessing the LUN simultaneously then defragmentation would have limited value as Brent suggests. But simultaneous access of the LUN would not always be the case, so would internal defragmentation of the VM disk still provide some value?

user7078
  • 365
  • 2
  • 5