Problem solve Get help with specific problems with your technologies, process and projects.

How to maintain virtual hard disks (VHDs) with Microsoft Virtual Server

Just like physical disks, VHD files need to be maintained over time. In this article, Anil Desai explains how to maintain VHD performance on Virtual Server host computers.

IT staff and end-users tend to demand a lot from their hard disk subsystems. We throw thousands of files and move or copy gigabytes of data practically every day. So it probably comes as no surprise that, over time, this can take its toll on overall performance.

Just like physical hard disks, virtual hard disk (VHD) files need to be maintained over time. In this article, I'll discuss how to maintain VHD performance on Virtual Server host computers.

Note: For an introduction to working with Virtual Server's disk architecture, see Understanding virtual hard disk options.

Monitoring disk performance
Since disk-related throughput and latency often affect overall VM performance, it's important to monitor disk activity to see if you're at or near the capacity of your exiting storage system. Table 1 provides a list of useful System Monitor counters that offer statistics for determining whether disk performance is a bottleneck.

Object Counter(s) Notes
Physical disk or logical disk - % Disk read time
- % Disk write time
- % Disk time
The percentage of time the selected instance was busy performing disk operations.
- % Idle time The percentage of time the selected instance was idle.
- Avg. Disk Bytes/Read
- Avg. Disk Bytes/Write
- Avg. Disk Bytes/Transfer
The average number of bytes requested per IO operation. This information can be useful when configuring RAID stripe sizes or network-based storage parameters.
- Current Disk Queue Length The number of read and write requests that are waiting to be processed. A large number can indicate that the disk subsystem might be a bottleneck.
- Disk Read Bytes/sec
- Disk Write Bytes/sec
- Disk Bytes/sec
The total throughput (in bytes). This is a good way to determine peak and average disk throughput requirements.
- Disk Reads/sec
- Disk Writes/sec
- Disk Transfers/sec
The number of read and/or write operations that are occurring per second.
Logical disk - Free Megabytes The amount of disk space remaining (in Megabytes).
- % Free Space The percentage of disk space remaining as a percentage of the total available disk space per instance.
Table 1: Disk-related performance counters

When monitoring disk activity at the host level, you'll get an aggregate view of activity generated by the host and all VMs combined. These statistics are helpful for determining if a hardware upgrade or rearrangement of files is necessary.

By viewing statistics at the level of each VM, you can determine which guest operating systems are generating the most disk activity. All of these details can help clue you in on how the disk subsystem is being used.

Defragmentation
Virtual hard disks are just as susceptible to fragmentation as are physical hard disks. The bad news is that you'll need to worry about disk fragmentation both at the host-level and within each guest OS. The frequency of running defragmenting operations will vary depending on the amount and type of activity within the VMs.

As a general rule, you should use the same schedule that you would use for physical machines that are performing similar activities. So, on a busy file server, you might want to defragment frequently. And on a largely static-content Web server, you might be able to go months without any performance degradation.

The catch is that you need to coordinate defragmentation operations between VMs and the host. Running multiple defrag operations at the same time will significantly decrease performance and will put a much greater load on the physical disk subsystem. It's a balancing act, but monitoring can help you determine the most appropriate schedule.

Compacting VHDs
Dynamically expanding virtual hard disks can be compacted to reclaim space that is currently allocated on the host system but is not actually used within the guest. This situation can occur if you've deleted a lot of data from within the VM or if files are often moved to and from the VM's file system.

Compacted VHDs are easier to move around (since they're smaller). They can also perform significantly better.

There are two main steps to getting optimal results. The first is to run the Virtual Disk Precompactor – a utility that is available as an ISO file that's included with the installation of Virtual Server. Just attach the ISO (or access the utility over the network) and run the executable from within the VM. The precompactor will reallocate space to ensure that you get the most efficient compact operation.

With the prep work out of the way, you can compact the VHD using the Virtual Server Administration Web site's Inspect Virtual Disks function (see Figure 2). In order to compact a disk, it must not be attached to any running VMs. You'll need roughly twice the total disk space of the size of the VHD, since Virtual Server actually creates a new VHD in the background.

The process can generate a lot of disk I/O and can use significant amounts of CPU time, so you'll want to perform the operation during periods of low activity. Other options are to script the process or to copy the VHDs to a non-production computer and compact them there.


Figure 1: Compacting a virtual hard disk

Developing a VM maintenance plan
So far, we've looked at various ways to improve performance. Now, let's look at how you can bring these ideas together to maintain performance in a virtualized production environment. A regular virtual machine maintenance plan might include the following steps:

  • Review virtual disk performance statistics and move VHD files, if necessary. (For more information VHD file placement, see the previous article in this series Designing virtual hard disk storage)
  • Compact all dynamically expanding virtual hard disks
  • Defragment all guest OS file systems
  • Defragment the host file system

The frequency of these tasks will vary based on usage patterns for VMs and the amount of downtime available (or, at least, the amount of time during which activity is low). It can be a lot of work, but it's usually worth the effort.

Third-party disk defragmentation tools can also assist with scheduling and centrally managing defragmentation operations.

A stitch in time…
The benefits of a flexible virtual hard disk architecture come at the cost of gradual performance decreases over time. In this article, we looked at ways for monitoring and maintaining the performance of VHDs to ensure adequate VM performance.

Next up in this series is the topic of using network-based storage for your VHDs.

Optimizing Virtual Server directory
Series introduction
Monitoring CPU and memory resources | Managing CPU resource allocation
Designing virtual hard disk storage | Maintaining virtual hard disks
Using network-based storage | Optimizing network performance


Dig Deeper on Microsoft Hyper-V and Virtual Server

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchVMware

SearchWindowsServer

SearchCloudComputing

SearchVirtualDesktop

SearchDataCenter

Close