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:
- Open Server Manager.
- Expand Storage.
- Right-click on Disk Management, select Attach VHD.
- Browse to the desired virtual disk file.
- Right-click on the disk, select Properties.
- Click the Tools tab, then click Defragment now.
- The virtual disk will take a few minutes for the defragmentation to complete.
- 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:
- Open a comand prompt and run the diskpart command.
- Run the following commands:
- select vdisk file =”Path to virtual disk file…”
- attach vdisk readonly
- compact vdisk
- detach vdisk