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 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: , , ,

# re: Giving Microsoft Virtual Server Differencing Disks a Spin

Thursday, August 30, 2007 11:36 AM by Chris V

Hello,

I have a small question regarding Virtual Server SP1 and differencing disk. I've setup an ubuntu 7.04 server and then I've stopped it and created a new virtual machine using the primary hdd an differencing disk to the ubuntu 7.04 server that I've created previously.

Problem: on ubuntu 7.04 server I can use the network interface and it's working but on the new virtual machine which uses the differencing disk...it doesn't see any network card, although it boots and everything looks ok.

I've tried to run both virtual machines at the same time but still no net card on the second virtual machine. can you please explan me what can be the problem? it's a by design thing?

many thanks!

all the best,

Chris

# re: Giving Microsoft Virtual Server Differencing Disks a Spin

Monday, September 10, 2007 3:16 PM by janiquec

OK, based on a test with Ubuntu 7.04 Server, it looks like the problem is the change in MAC address that occurs when you create the new Ubuntu Server VM with the diff disk. Based on some info in the Ubuntu forums, when you install Ubuntu, the netcfg iterates the network cards plugged in with drivers loaded and writes the MAC address of each to the /etc/iftab file of the installed system:

eth0 mac 01:23:45:67:89:ab

When you create the new VM and the MAC address changes, the information in /etc/iftab is no longer correct and your Ethernet interface fails to start.

The solution is to go edit the /etc/iftab file in your diff disk VM, insert the new MAC address that Virtual Server 2005 R2 assigns, and reboot Ubuntu. Then your Ethernet interface should start and your networking should work.

# re: Giving Microsoft Virtual Server Differencing Disks a Spin

Saturday, September 15, 2007 8:30 AM by Chris

hello,

I was gone for a couple of days. I've just tested your discovery and it's working. thanks for helping me out with this.

all the best,

Chris

# re: Giving Microsoft Virtual Server Differencing Disks a Spin

Tuesday, September 18, 2007 7:20 PM by mcwoods

I can see from your explanation that if I wanted to make the differencing disk portable I only need to copy the parent and child and then keep them in the same.  

My question: Is there a way to pull those two VHD's into a single VHD?  Or if I had a chain of VHD's, to make them into a single VHD?

Thanks!

# re: Giving Microsoft Virtual Server Differencing Disks a Spin

Thursday, September 20, 2007 10:09 AM by vs-admin

In response to "mcwoods":

Yes, you can merge the two VHD's into one. If you would like to learn how to do this, you should download the following sample chapter from the Microsoft Virtual Server 2005 R2 Resource Kit at vscommunity.com/.../entry39.aspx.

It has a section, starting on page 114, which explains the options you have using Virtual Server to merge differencing disks. You will also find step-by-step instructions on how to perform the merge operation.

Good luck!

# re: Giving Microsoft Virtual Server Differencing Disks a Spin

Thursday, September 20, 2007 10:38 AM by mcwoods

Very cool thank you for the quick response.  It came just in time for me to continue testing.  

Another question however: According the VS Help you shouldn't use Undo Disks on a domain controller.  However in the sample chapter you linked above it actually gives using a DC as an example of where you could use Undo Disks.  

Any clarification?  I'd really like to use Undo Disks on a DC.  

Thanks!

# re: Giving Microsoft Virtual Server Differencing Disks a Spin

Thursday, September 20, 2007 11:12 AM by vs-admin

The figure which I think you are referencing from the sample chapter showing the use of Undo disks deserves a little clarification.

If you look at the heading in that image, it shows a Software Test Environment configuration. So, in that type of scenario where you may need to roll back an entire group of test VMs (DC, App servers, and so on) to a previous state or baseline configuration, then you could use Undo Disks to accomplish this. However, the caveat is that to you must synchronously roll back all of the VMs to conserve the integrity of the environment, specially if you have multiple domain controllers in your group of test VMs.

In a production environment, the VS help is right. You should never use Undo disks on Domain Controllers that are running in production.

# re: Giving Microsoft Virtual Server Differencing Disks a Spin

Thursday, September 27, 2007 5:06 PM by Daniel

If a virtual machine is looking for a parent differencing disk in a location that no longer exists, how do you change the search path for that base drive???

I would like to know by way of the interface or a script.

Thanks!

# re: Giving Microsoft Virtual Server Differencing Disks a Spin

Friday, September 28, 2007 1:40 PM by janiquec

Daniel,

This scenario is covered in the Virtual Server 2005 R2 Resource Kit book, but here are the basic steps:

Use the Inspect feature from the VS Administration Website Virtual Disks menu and select your differencing disk.

Clicking Inspect again on this page will bring up the child differencing disk VHD properties. If your parent VHD has been moved, you should see a link that will unable you to update its' path.

Clicking the link should allow you to either select the parent VHD from a Parent Virtual Hard Disk Path pull-down menu or enter the fully qualified path to the parent VHD in the text box.

If you have a copy of the resource kit book, the companion media contains a VB script named FixDiffDisk.vbs that you can use AS-IS or customize to update parent VHD references for differencing disks.

# re: Giving Microsoft Virtual Server Differencing Disks a Spin

Friday, January 18, 2008 4:59 AM by Holger

Hi,

I tried to save space with chaining differencing disks. I made a "winxp only" disk, a differencing "winxp with .net 2.0" disk and on top of that a "windxp with .net and SQL2005 Express" disk. First I wondered why the .net 2.0 differencing disk has a size of over 2GB. Than I looked closer after starting the machione with new "... with sql2005" disk (to install sql2005). A short time after startup without doing anything, the difference file has grown up to 300MB already. Then I downloaded the 40MB of the SQL 2005 Express installer. The Download of this 40MB (without actually installing) increased the file size of the differencing disk to 1GB. 40MB added => 700MB Increase in file size of the differencing disk. Is that normal?

Thanks.

# re: Giving Microsoft Virtual Server Differencing Disks a Spin

Monday, January 21, 2008 3:36 PM by vs-admin

Holger - Could there have been any Windows updates automatically being downloaded in the background? You don't say whether you had patched the parent WINXP disk with all the updates prior to creating the differencing disks.

# re: Giving Microsoft Virtual Server Differencing Disks a Spin

Wednesday, January 23, 2008 8:48 AM by Holger

Yes. I did. There were all updates installed. Because your question, I assume that this space consuming is not quite normal. So your differencing disks does not increase this much in size? Is there any way to inspect the differencing disk file to find out what differences are actually stored there?

# re: Giving Microsoft Virtual Server Differencing Disks a Spin

Friday, January 25, 2008 8:36 AM by vs-admin

I would suggest that you try to compact the VHDs to see if you get any significant size reduction. That would tell you whether there were a high number of empty blocks. If the VHD size does not change much, then it's most likely valid data. You can use the tools that come with Virtual Server or get something like the VOptimizer tool by Invirtus.

Leave a Comment

(required) 
(required) 
(optional)
(required)