12-30-2006 11:20
janiquec
Giving Microsoft Virtual Server Differencing Disks a Spin
A differencing disk is a special type of dynamic disk that stores changes to virtual machine state in a file separate from the base VHD. Differencing disks are defined in the context of a parent-child relationship. In this relationship, each child differencing disk has one and only one parent disk, but a parent disk may be associated with multiple child differencing disks.
Differencing disks can be created in simple or complex hierarchies. Creating a multi-level differencing disk hierarchy is called "chaining." The disk hierarchy is referred to as a chain of differencing disks, reflecting that a child differencing disk can have a parent disk that is also a differencing disk. A chain of differencing disks can consist of several levels, but at the top of the hierarchy, there is always either a standard dynamically expanding or fixed-size VHD. This concept is important because state changes in a differencing disk are represented as modified blocks in relation to a parent disk. Therefore, differencing disks are never used independently, but in conjunction with all parent disks in the hierarchy.
Every VHD contains a standard header that you can find described in the "Virtual Hard Disk Image Format Specification" whitepaper. Pivotal to dynamically expanding VHDs is the dynamic disk header contained in the standard VHD header. Since differencing disks are just a special type of dynamically expanding VHD, the dynamic disk header format is identical for both standard dynamically expanding and differencing disks. However, several fields in the dynamic disk header are relevant only to differencing disks. These special fields identify parent disk attributes.
When a differencing disk is opened, it uses the parent UUID and Unicode file name information stored in its’ dynamic disk header to locate and open its’ parent disk. Since a parent disk may also be a differencing disk, it is possible that the entire hierarchy of parent disks will be opened, up to the base virtual hard disk.
When a virtual machine using differencing disks issues a write operation, the new data is written only to the child differencing disk. An internal VHD data structure is updated to reflect the changes, effectively indicating that newer data is contained in the differencing disk. In effect, the modified data block in the differencing disk supersedes the data block in the parent disk. During read operations, the internal virtual hard disk data structure is checked to determine which modified data blocks to read from the child differencing disk. Unchanged data blocks are read from the parent disk.
Differencing disks are portable across platforms because of the information stored in the Parent Locator entries of the dynamic disk header. These entries contain platform specific path information that allows a child differencing disk to locate a parent differencing disk on a physical drive.
For the Windows platform, the absolute and relative path of the parent disk are stored in the Parent Locator entry of a differencing disk. So as long as you copy the VHDs to the same relative directory hierarchy on a new Microsoft Virtual Server system, you can add a virtual machine and turn it on without having to make any other changes.
Differencing disks are very useful in scenarios that require multiple complex configurations sharing a large common base. You only have to build the common base configuration once, then create additional virtual machines with incremental changes using differencing disks that have the base configuration VHD as a parent disk. Using differencing disks in this manner not only help you to execute concurrent, but individual virtual machines on a Virtual Server system, they also save you a significant amount of physical disk space.
Filed under: Virtualization, Virtual Server, Virtual Machine, Virtual Hard Disk