Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

4 Answers

up vote 4 down vote accepted

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.

share|improve this answer
    
+1 for solidness. Got any links to docs by chance? –  SQLChicken Jun 2 '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 2 '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 7 '11 at 14:06
add comment

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.

share|improve this answer
    
Conversely though, the VM does not know how the data is stored within the physical drive or SAN that backs it. –  Dan Carley Jun 2 '09 at 13:30
add comment

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.

share|improve this answer
add comment

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?

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.