Virtualization

Get IT Done: Creating a test lab on one machine using VMware Workstation

Even though IT budgets are tight, you still need hardware to test different operating systems. Here's how to configure and customize VMWare to help ease your budget crunch.


If you frequently test hardware, operating systems, and applications, you know that you're likely to spend many frustrating hours rebooting while you troubleshoot problem apps, drivers, services, and patches. If so, creating a test lab using virtual machines software will save you a lot of downtime. Two popular applications are Virtual PC (formerly made by Connectix, but recently purchased by Microsoft) and VMware. Here's how to use VMware Workstation 4.0 to create a test lab on one machine.

Advantages of virtual machines
Virtual PC software allows you to install and run guest operating systems within your computer's operating system, which acts as a host. The virtual systems share the workstation's devices and are stored in files. Therefore, each virtual machine is isolated from the other and from the host; if one fails, the host machine and all the other virtual machines remain unaffected. You can continue to work while you reboot a crashed guest.

In addition to testing, VMware and Virtual PC allow you to run different platforms and platform-specific software that may be incompatible with your OS. For example, within Windows 2000, you could run a Linux Web server and test Office 2003 on Windows XP. Further, workstations equipped with virtual guest systems allow you to consolidate training and IT support onto fewer workstations.

VMware and Virtual PC share similar features and concepts. The major differences between the two are that VMware versions support Linux either as a guest or host operating system, while Virtual PC does not, and that one Virtual PC version allows you to run Windows within Mac operating systems.

Installation, hardware, and software requirements
Register for a VMware license at www.vmware.com, then download the approximately 21-MB program file. If you prefer to test the software first, you can register for a free 30-day demo.

VMware Workstation 4.0 for Windows can be installed on Windows NT, 2000 (workstations and servers), Windows XP Professional and Home Edition, and Windows Server 2003. For more specific information about host requirements, see the VMware Workstation specs.

VMware 4.0 supports the following guest operating systems:
  • MS-DOS 6.x
  • Windows 3.1 through Windows XP workstations
  • Windows Server 2003 Web, Standard, and Enterprise editions
  • Red Hat Linux 7.0-9.0
  • Red Hat Linux Advanced Server 2.1
  • Mandrake Linux 8.2 and 9.0
  • SuSe Linux 7.3 through SLES 8
  • Turbolinux Server 7.0, 8.0, and Workstation 8.0
  • FreeBSD 4.0-4.62 and 4.8.
  • NetWare 5.1 and 6.0

The minimum hardware requirements for running VMware Workstation 4.0 are:
  • 500-MHz CPU (multiprocessor systems are supported)
  • 128 MB of RAM (256 suggested, but you can apportion up to 1 GB of RAM between virtual machines)
  • 100 MB of free disk space

To enable VMware to run more than one guest OS at a time, you will need much more than the CPU and RAM minimums. Your test station will benefit from a processor of at least 1 GHz, 1 GB or more of RAM, and separate hard drives for each virtual machine you plan to run simultaneously so they won't compete for read/write operations.

There are several other reasons for reserving plenty of disk space for virtual machines. Each time you save a guest OS configuration (called a Snapshot, discussed below), you need enough file space to store it. Further, your virtual disk can be configured to grow dynamically. (You can choose to automatically split virtual disks into 2-GB files as they grow.) At some point, you will need to defragment and shrink your virtual systems. To do so, you'll need somewhat more free space than the amount taken up by the virtual disk files.

For example, if you plan to allow a virtual Windows XP installation to grow to 10 GB, leave about 22 GB on a hard drive. If you plan on taking periodic Snapshots of the disk configuration, then leave about 30 or more GB on the drive.

Once VMware is installed, you use it to create a test lab by:
  • Configuring new virtual machines
  • Installing operating systems
  • Adding VMware Tools to each guest OS
  • Installing applications, patches, and updates
  • Using Snapshots to save test configurations
  • Copying, backing up, moving, and renaming virtual disks

Configuring new virtual machines
To create a new virtual machine, choose File | New | New Virtual Machine from the VMware menu. Choose Custom Installation. Pick a guest operating system from the drop-down list. Next, set a name and a location for the new virtual machine.

The next few screens allow you to configure RAM size, networking method, and other devices. If you need to change these settings later, you can do so by choosing Edit | Edit Virtual Machine Settings from the VMware menu.

Choose a memory allocation based on the recommended guest range. This is provided by VMware based on your total available memory (Figure A).

Figure A
You can allocate virtual machine RAM in increments of 4 MB up to the total permitted by VMware.


Next, configure networking. Choose Bridged, Network Address Translation (NAT), Host-Only, or None (Figure B). NAT requires few or no additional steps and is the easiest to set up; Bridged Networking involves setting up a separate IP address for the guest on the network.

Figure B
Choosing NAT will be the quickest way to get your new virtual machine on the network.


On the following screen, select Create A New Virtual Disk. Other choices are to reuse an existing virtual disk and have VMware access a physical disk. In the latter case, the guest OS reads and writes directly to the drive or partition. This is useful for multiboot machines if you want to run the alternate operating system(s) as a guest. However, it is not the best choice for a test machine, as directly accessing the physical disk invalidates the protections of using isolated virtual disks.

Next, specify a virtual disk capacity (Figure C). Remember to leave ample room for testing, as well as enough space on the hard drive where the virtual disk will be stored for shrinking and defragmenting. Splitting the disk into 2-GB files makes it easier for VMware to perform these operations. If you desire, choose to allocate the entire virtual disk at this time rather than having it grow dynamically.

Figure C


Virtual disks grow dynamically unless you specify otherwise. Splitting the disk into 2-GB files will ease later defragmentation and shrinking operations.

Maximum disk capacity workaround
The Specify Disk Capacity dialog states that a virtual disk can never be larger than the maximum capacity you allocate now. This is not strictly true. VMware has published a workaround using Norton Ghost to increase disk capacity later. However, the process is tedious, so it's better to set a workable limit at the beginning. An easier way to work around a disk capacity limit is to add additional virtual disks to a guest OS.

After you complete the Disk Capacity dialog, VMware will allocate the space. This operation can take some time.

Figure D shows VMware's tabbed display. You can switch from one guest to another using this interface. Highlighted is the new virtual OS, "Windows 2000 Pro on X:\." After configuring this guest, it receives a tab even though it has not yet been powered on. The summary lists all configured devices for that virtual machine.

Figure D
The new virtual machine is displayed in its own tab.


Whenever the guest is powered down, you may add or modify a device by clicking Edit Virtual Machine Settings. For example, to allow printing through the host, in the settings dialog, click Add, then select Parallel Port. VMware supports most standard devices you will need.

Modify a device by double-clicking it in the edit dialog. For example, if you have more than one CD drive, Auto Detect might sense the drive without the installation disk when the OS is powered on. Double-click CD-ROM to change from Auto Detect to a specified drive letter. You are limited to one CD-ROM per virtual machine.

Installing a virtual OS
Once you have configured devices on the new virtual machine, you are ready to install an operating system. Place the operating system installation CD in the drive and power on your new guest by clicking Start This Virtual Machine. You may also create an ISO image and configure the new guest operating system to boot from it by choosing Edit | Virtual Machine Settings, clicking on CD-ROM, and setting the CD-ROM to the location of your ISO image.

Inputting within the new virtual machine
Initially, you must first click the mouse within the VMware window to enter any mouse or keyboard input into the guest machine. To remove focus from the guest, simultaneously press [CTR][ALT]. After you install the new OS and VMware tools, the host and guest systems will automatically grab focus for keyboard and mouse input.

If VMware doesn't boot from the installation CD, access the virtual machine BIOS when booting up by pressing F2. (First, click the mouse within the guest screen to give it focus.) Select the boot menu and add CD-ROM Drive (Figure E). Exit the BIOS by pressing [F10].

Figure E
To boot from the installation CD, add CD-ROM to the virtual PhoenixBIOS Boot menu.


Your operating system setup program will load and run exactly as it would for a physical machine. Here are a few items to be aware of:
  • Disk formatting: Don't be alarmed when the setup program reports that it has found a new hard disk and warns that data on C may be lost. Format the virtual disk—no data on your host will be harmed.
  • Windows XP, Office XP, and Office 2003: Licenses for these products are valid for installation on one physical machine at a time. These licenses must be activated through the Internet. If the activation service detects the new virtual machine as separate hardware, then the products on the guest machine will be set to time-limited demo versions. If this happens, call the Microsoft Product Activation Center number given in your product. The staff is usually generous in granting additional activation keys that register multiple installations of products on the same hardware. But you may be required to purchase additional licenses.
  • Service Pack 3 issues:A Windows 2000 guest with Service Pack 3 installed may not boot. Before powering down a Windows 2000 guest, upgrade to Service Pack 4. If this isn't possible, VMware has a workaround.
  • Linux installations: Linux X System graphic drivers will not work properly until after WMware tools are installed. Therefore, use the text-based installation and do not start XFree 86 until after you install VMware tools from the Linux console. Instructions for installing VMware tools are given below. In addition, VMware recommends deactivating screensavers under Linux guests as they can cause the virtual machine to hang.

For more information, tips, and tricks, check VMware's Guest Operating System Installation Guide and the VMware support page.

Installing VMware tools
VMware tools' SVGA driver is necessary for setting high screen resolutions and accelerating video performance on the guest machine. Other useful features include automatic switching of mouse and keyboard focus between the host and guest screens and the ability to shrink the virtual machine and conserve disk space.

To install VMware tools on a Windows guest, start the guest operating system. When it is running, choose File | Install VMware Tools from the VMware menu.

Additional VMware tool-tweaks for various Windows OSs are listed in the VMware Workstation manual that comes with the program.

To install the tools on a Linux guest, start Linux and log on as administrator or superuser (su -). Do not start the X server. Choose File | Install Vmware Tools from the VMware menu. The next steps are performed in the Linux console:

Mount the VMware Tools virtual CD-ROM image and change to a working directory (i.e., /tmp). (This image is an ISO that appears as a CD-ROM to the Linux guest.) To do so, type:
mount /dev/cdrom /mnt
cd /tmp
tar zxf /mnt/vmware-linux-tools.tar.gz

Next, unmount the CD-ROM image by typing:
umount /mnt

After that, run the VMware Tools installer and exit from the root account by typing:
cd vmware-tools-distrib
./vmware-install.pl
exit

Finally, type startx to launch your graphical environment. Once it loads, launch the VMware Tools background application in a terminal window by typing, vmware-toolbox &.

Installing applications, updates, and patches
Once you've installed your guest OSs and VMware tools, you're ready to install applications, updates, and patches. Set these up exactly as you would on any other system. Download and install updates within the virtual machine.

Using Snapshots
The Snapshot feature allows the entire state of guest systems, including disk data, memory, and settings, to be preserved whenever you desire. A Snapshot is useful for testing, as you can revert any virtual machine to a previously saved state. You are limited to one snapshot at a time.

To create a Snapshot, with the guest OS running, choose Snapshot | Save Snapshot from the VMware menu. A progress bar will appear with the message Saving Virtual Machine State. This operation can take some time. Snapshot information is stored in a file with the extension .vmsn, and additional files with REDO as part of the extension. Each time you create a Snapshot, the previous one is updated with the virtual machine's current configuration.

To return the guest OS to a saved configuration, choose Snapshot | Revert To Snapshot from the VMware menu. You can prevent the current Snapshot from being updated by selecting Edit | Virtual Machine Settings, clicking the Options tab, and then clicking Snapshot. Check the box, Lock This Snapshot (Figure F).

Figure F
Locking a Snapshot will prevent accidental configuration changes. Note that the date and time of the current snapshot is displayed in this screen.


During testing, you may find it useful to revert the guest OS to the Snapshot state each time it is powered down. In the Snapshot Options panel, under When Powering Off, click Revert To The Snapshot. Alternatively, you may choose to update your Snapshot when the virtual machine is powered off.

To remove a Snapshot, first power down the guest OS, then choose Snapshot | Remove Snapshot. If the OS is not powered off, this option will be grayed out.

Copying, backing up, moving, and renaming virtual disks
Copying, moving, and backup operations are as simple as manipulating the virtual machine's files and selecting File | Open from the VMware menu to make VMware aware of a new or moved virtual machine. Note, however, that when moving a virtual machine to a different physical machine, you will need to edit the guest's device settings for the new hardware. Further, if the new computer uses a different processor, a Linux guest may not work on the new machine. This is due to the fact that Linux installations choose a kernel optimized for either an Intel or AMD processor.

Editor's Picks