RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Virtual Machines in the Build Process: Lower Risk, Greater Portability : Page 2

When you set up a clean build environment inside a virtual machine, the build environment is not only independent of the host environment but it also is easy to back up and restore, and port to new hardware.

Backing Up Your VM Environment
After you've installed the prerequisites and performed the necessary configurations, you should back up your VM environment. You can achieve this in a few different ways using the tools VMware provides.

The primary option for backup is VMware's snapshot feature. A snapshot captures the state of the VM at a particular point in time. After you take a snapshot of your clean build environment, you can restore your VM to the snapshot state if something goes wrong. All the changes that you made since taking the snapshot will be erased.

Snapshots are one area where VMware Workstation and VMware Server differ. VMware Server allows only one snapshot, limiting you to your base VM and the one snapshot you take. VMware Workstation allows multiple snapshots and multiple trees of snapshots (see Figure 4).

Click to enlarge

Figure 4. Snapshot Manager in VMware Workstation:
VMware Workstation allows multiple snapshots and multiple trees of snapshots.

The downside of using multiple snapshots is that they can slow the performance of the VM on older hardware. My build machine has a very fast serial ATA drive so the performance difference between having three or four snapshots and having none is very small. However, when I added four snapshots to the VM on my old build machine that had slower IDE drives, the performance took a hit.

The benchmark I used was timing how long JBoss took to start. On the old build machine with no snapshots JBoss started in roughly three minutes. When I added four snapshots, JBoss took between four and five minutes because VMware Workstation creates a new virtual disk for every snapshot you take. Each snapshot contains the differences between itself and the previous snapshot. As you add more snapshots, more disk activity is required to load all the difference files. This activity increase is an issue only with VMware Workstation because it allows multiple snapshots, whereas VMware Server allows only one. As long as you have fairly modern hardware, you may not notice the performance difference at all.

Another method that you can use to back up your VM is copying the entire VM folder to a new location (also known as cloning). One of the major differences between VMware Server and VMware Workstation is that Workstation provides a Clone function that allows you to perform this operation right from the Workstation GUI. It even allows you to specify a new name for the copied VM. With VMware Server, you have to copy the folder manually. Be sure to close your VM before attempting this operation. After you create your backup, you can easily restore it and start from a clean environment that is already configured for your build if anything goes wrong.

Whichever solution you choose, be sure to perform a full backup of your VM to another machine or server. I keep several copies of my virtual machines backed up on a server that is managed by our IT department as well as on an external hard drive.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date