Optimizing Provisioning Server Dynamic Disks

By Timothy Karl
Posted in Virtualization
On January 22, 2014

In Citrix Provisioning Services, there are two options for creating virtual disks: fixed and dynamic. When both of these disks are created, you set the maximum size up front that will appear in the guest virtual machine. The difference between them is the amount of space allocated up front. With a fixed disk, all of the space is allocated up front. When a dynamic disk is created, only a small amount of space is created up front. The size of the dynamic disk increases over time as you begin to use more space inside of the disk.

The main advantage of using dynamic disks is that it reduces the amount of storage required for virtual disks. This leads to lower storage costs and allows for easier virtual disk management. However, over time, dynamic disks will grow as data is added to the virtual disk. When data is removed from the disk, the size of the virtual disk does not decrease. The virtual disk size remains at the largest amount of data size that was ever stored in the VHD.

In order to maintain the advantages of using dynamic disks, it is important to perform regular optimizations. These optimizations should be performed after any changes are made to the virtual disk in write mode. The optimizations are made from a provisioning server in the farm.

Defragment: Because files are constantly being written and deleted from a dynamic disk, it is important to perform regular defragmentation of the virtual disk. This will move all of the data to the front of the disk, which will increase performance.

To defragment the virtual disk, follow this procedure:

  1. Open Server Manager.
  2. Expand Storage.
  3. Right-click on Disk Management, select Attach VHD.
  4. Browse to the desired virtual disk file.
  5. Right-click on the disk, select Properties.
  6. Click the Tools tab, then click Defragment now.
  7. The virtual disk will take a few minutes for the defragmentation to complete.
  8. After it is defragmentation is complete, Right-click on the disk, select Detach VHD. (Ensure that you do not delete the VHD when you are detaching the VHD.)

Compact: After a dynamic disk is defragmented, it should be compacted using the Windows DiskPart utility. This will reduce the size of the virtual disk to match the amount of data stored within the virtual disk.

To compact the virtual disk, follow this procedure:

  1. Open a comand prompt and run the diskpart command.
  2. Run the following commands:

  • select vdisk file =”Path to virtual disk file…”
  • attach vdisk readonly
  • compact vdisk
  • detach vdisk
  • exit
Timothy Karl

Timothy Karl

Tim has over 10 years’ experience in the design, development, and deployment of Windows infrastructure technologies. His experience also includes the high-level design of complex thin client and server-based computing environments. He is highly fluent in all aspects of Windows and Citrix infrastructure technologies.