Should you use Guest OS built-in fragmentation tools in a virtual environment?
search cancel

Should you use Guest OS built-in fragmentation tools in a virtual environment?

book

Article ID: 340594

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

Can a VMFS volume, vSAN/vVol datastore be defragmented?


Environment

VMware ESXi (All Versions)
VMware vSAN (All Versions)

Cause

Disk Fragmentation is when blocks belonging to a file are scattered over the platter of a mechanical hard disk in a non-contiguous way, thus increasing disk seek and rotational latency.

Resolution

VMware by Broadcom doesn't recommend using Defrag/Optimization tools within the Guest OS for the following reasons:
 
  1. VMFS volumes are built on RAID volumes, which doesn't really benefit from Defrag. Also, with the increasing move to SSD/NVMe solutions both in physical servers as well as Storage Arrays, Defrag should not be used at all since moving blocks around directly affects the write lifespan of the flash devices that support those RAID volumes.
  2. Guest OS built-in Optimization tools are designed for physical drives which the Guest OS runs from. When it comes to Virtualization, these tools don't have an understanding of the backing storage which the virtual disk files/objects reside. 
  3. Thin Provisioned VMs: If you defragment a Thin Provisioned VM, as file blocks are moved around, the TP VMDK bloats up, consuming much more disk space.
  4. Linked Clone VMs (vCloud Director, View). In the case of a VM running off of a linked clone, the defragmenter bloats up the linked clone redo logs.
  5. Replicated VMs (Site Recovery Manager, vSphere Replicator). If your VM was being replicated, and you defragmented the VM on the protected site, it could well cause a lot of data to be sent over the WAN to the replicated site.
  6. Snapshot’ed VMs: This is a similar use case to Linked Clones. Any VMs running off of a snapshot which ran a defrag would cause the snapshot to inflate considerably, depending on how many blocks were moved during the defrag operation.
  7. Change Block Tracking (VMware Data Recovery): The CBT feature is used heavily by backup products, including VMware Data Recovery (VDR). This feature tracks changes to a VM’s disk blocks during a backup operation. If a defrag is run during a backup operation, the number of blocks that changes will increase, which means more data will have to be backed up, meaning a longer backup time.
  8. Storage vMotion: Storage vMotion also uses CBT in vSphere 4.0. If a VM was being Storage vMotion’ed when a defrag operation was initiated, it would also impact the time to complete the operation since the defrag is changing blocks during the migration.
 
You can use 3rd Party tools like DymaxIO that specialize in optimizing virtual environments for defragmentation of Windows guest virtual machines.
 

 

Additional Information