I was really torn on just how big of a difference, using differencing disks in Virtual PC was giving me on saving diskspace, until I spent some time last night with the following tests to see if it was worthwhile for me.
Let me state, your methods for using Differencing disks may be completely different than mine, and in some scenarios, there is big benefit. These are simply “My” opinions based on how I do “My” virtual machines :).
First let me start with a post from my peer at Mindsharp, Andrew Connell titled HOWTO: Use Virtual PC’s Differencing Disks to your Advantage. (Note, Andrew has already stated he needs to do another update on the article, I’m just basing this post on what’s contained in it)
Andrew did a great job of detailing how he uses Differencing Disks to optimize his development environments. The problem I have with this scenario, is on his second section about defragmenting the second layer base disks.
What I found, is if you defragment the differencing disk (Because the second layer, or final layer for that matter, “IS” a differencing disk), it actually causes more diskspace to be used.
Because the differencing disk is a “Delta” of the layout from the original base disk to the new disk. If the defragmenter sees that it’s best to move around files in the differencing disk, that were core files from the base disk, the size of the differencing disk is expanded to record the change from the base disk itself. Therefore if you optimize your differencing disk, you run the chance of completely negating what you set out to do.
To see the difference in results, I performed the following task with some images I already had. Here was the basic layout:
This was my base disk which I believe the name pretty much denotes what it contained. It was precompacted, and defragmented before it was SYSPrepped.
From this base disk, I built out my development environment as follows
krichie.dom consists of the following machines (All sizes in KB, and the Initial Size is the size of the differencing disk “After” defragmenting):
DC and SQL2005 (I placed the SQL databases themselves on a completely different virtual disk, but I’m not including that size here, as it doesn’t come into the overall equation). This is the initial DC for my krichie.dom forest
Initial Size: 4,322,372
Total With Base: 7,563,134
Member server of krichie.dom with MOSS2007 installed on it, as well as Visual Studio 2005 (Yes I even installed MSDN for 2005, I know there are better ways to handle this, but well…I wanted it to be there in case I was disconnected and could not pull up online. I’m pretty sure that at some point, I will re-configure it to put MSDN on a seperate shared virtual disk, so I can port it around and re-use it…thus reduce the overall size of my virtual disk)
Initial Size: 11,996,053
Total With Base: 15,236,815
Member server of krichie.dom with SPS2003 installed on it, as well as Visual Studio 2003 (And yes, MSDN for 2003 on it)
Initial Size: 7,995,332
Total with Base: 11,236,094
Take the initial size of the three differencing disks + the single size of the base disk, and that equates to: 27,554,519. That’s 27 GIG!. The Initial Size of the differencing disks became so large because of the defragmenting. As well, I noticed that precompacting them also increased their size too, again…it’s all because of the delta from the base image.
When I saw this, I realized that I’m not really saving anything from using differencing disks IF I defragment them. If I didn’t defragment them, then yes, I would be saving tons of space, but the differencing disks would be horribly slow because of fragmentation.
I then took each differencing disk, and merged them with the base into new images, and the result was as follows (Values are the merged sizes):
Therefore, with unique non differencing disks, the total size was 27,675,340. An actual disk space loss of 120,821 (120 MB)
But then, I defraged each disk, precompacted, and compacted and the results were as follows:
Afterwards, my total disk space used by the images was 20,853,835, which in the end, saved me 6,700,684, nearly 7 GIG of diskspace.
In conclusion, if you need to fire up quick environments for whatever reason, then yes…using Differencing disks and a base image like this is a dream. But, in my scenario, the overall disk loss doesn’t help me. Yes, I’m going to hate rebuilding these things all the time because of activation (I don’t have a Volume License key for Windows Server :)), but I’ll just live with that for the time being.
I’ll post a follow up to this, after I give it a whirl.