Defragmentation in a Virtual Environment

 


Virtualization is taking off.  IT shops are implementing it for everything from server consolidation to testing to recovery.  If you are not already benefiting from it, you likely will be soon.

 

There are many ways to ensure your virtual environments operate at optimal performance – not overloading the host machine, allocating the appropriate amount of memory, and storing the virtual machine files on a disk separate from the OS are among them.  Defragmenting is another and is equally important.

 

In virtual environments, you not only need to be concerned about the fragmentation on each of your virtual machines (VMs), you also need to be concerned about fragmentation on the host machine.  A fragmented drive on the host machine will cause performance issues on the VMs.  Each virtual machine is stored as a file on a host machine.  This file may become fragmented, which may lead to excessive I/O activity. Unnecessary I/O affects overall performance, with operations such as starting and stopping your virtual sessions being negatively impacted.  For best performance on drives that store the virtual machine files, it is recommended that you use the maximum cluster size (64K).

 

If your virtual environment is configured with dynamically expanding or variable size disks, then defragmenting is especially important.  As data is written to the virtual drive, the size of the virtual machine file on the host machine grows as needed.  With the file size growing, the file will become increasingly fragmented.  The size only grows.  The file size is not reduced as data is removed.  In order to reduce the size of the file, you would want to use a compaction utility.  The compaction utility will remove any unused space in the virtual machine file.  This will not only shrink the size of the virtual hard drive file, but it should also reduce the amount of time it takes to defragment.  A critical consideration with dynamically expanding or variable size drives is the free space on the drive.  Fragmented free space may increase the level of fragmentation of the virtual machine file as it grows if there is not a large enough piece of free space in which the file will fit.  Prior to running the compaction utility, it is recommended that you run a defrag pass to consolidate free space.  This will result in better results of the compaction on your dynamically expanding or variable size disks.  Completely defragmenting free space is something only PerfectDisk does.

 

Fragmentation happens on virtual machines the same way it happens on physical machines.  Fragmentation can occur when files are created, modified, or deleted.  It is equally as important to defragment each of your virtual machines as well as the virtual machine file on the host machine to achieve optimal performance. 

 

The purpose of the virtual machine, be it a web server, application server, file server, etc., will determine how quickly it will become fragmented.  So how often defragmenting should occur on your virtual machines is best determined by you.  But understanding the importance of regularly defragmenting both the virtual machines and the physical drives on the host machine will help you to achieve optimal performance.