2.5.2 A Virtual Lab (part 2By Val Bakh. We have previously discussed the use of virtual hard drives (VHDs). As an alternative to a lab with physical computers, we discussed the possibility of a virtual computer laboratory. We’ll now discuss how to organize this new lab.
There are three types: dynamically expanding, fixed, and differencing VHDs. Fixed VHDs are similar to regular hard drives in that the file size (.vhd) corresponds to the VHD’s storage capacity. A dynamically expanding VHD behaves like a balloon. It starts small and grows as you add more data to it. A differencing VHD is the best VHD to use in a virtual lab. It is like a dynamically growing child of another VHD. A differencing VHD acts as a starting point or benchmark. Everything that changes is passed on to the child.
Install Windows Server 2008 R2 on the computer where you want your virtual lab to be implemented and add the HyperV role. Next, create a virtual machine with a dynamically expanding VHD. Finally, install Windows 7 or any other supported version of Windows. To generalize the installation, shut down your VM and make it read-only, you can use the Sysprep tool. This will serve as your base VHD for future Windows 7 VMs. You can create a new Windows 7 VM in a matter minutes. You only need to create a VM using a different VHD, whose parent is the aforementioned VHD. The VM automatically sets up itself and you will have a fully functional Windows 7 VM in five minutes.
Take a snapshot of your VM at this point. The system creates a new differencing VHD automatically. Its parent is the previous differencing VHD. Now you can start testing. You can apply the snapshot to the VM when you are done with a batch of tests. The VHD that was used to create the last difference will be deleted and a new one created. The entire process takes only seconds. This allows you to take a snapshot at any point in your testing and then return to it whenever you wish.
You will need one base VHD to host each guest operating system version in your lab. Multiple VMs can use the same base VHD as their parent. Instead of having a separate base VHD for each VM you can have a separate image for each operating system. This saves you a lot of time, effort, and money.
This method, which allows multiple VMs to run on different VHDs with a common parent VHD, is not recommended for production environments. A dedicated fixed VHD will work best for production because it will provide better performance as well as greater reliability. Performance and reliability are often more important in production than the ability to start at square one three times per day.