Virtual Server 2005
Do More With Less: Exploring Virtual Server 2005
At a Glance:
- Understanding virtualization technology
- Installing and configuring Virtual Server 2005
- Performance tuning, scripting, and security
- Virtual system management best practices
Over the years, computing hardware performance has grown at a dramatic rate. There’s always some hungry application waiting to gobble up all that power, but many machines run
at a small fraction of their total capacity, taking up precious space, administrative effort, and resources. If you’ve ever wished you could saw a server into small pieces so it could be more productive (not to work out your frustration), server virtualization may be the solution you’ve been dreaming about.
Put simply, server virtualization allows you to run multiple operating systems concurrently on a single computer. Microsoft has released several versions of the Virtual PC product for workstations, and recently shipped a server-side solution in Virtual Server 2005, and the subsequent Virtual Server 2005 R2 release, that can provide dramatic advantages to your organization’s IT department. In this article, I’ll focus on the benefits of virtualization, the architecture of Virtual Server 2005, and best practices for making the most of Virtual Server in your server room.
Virtual Server 2005 is essentially a service that runs on Windows Server™ 2003. Using Virtual Server, you can host up to 64 virtual machines (VMs), each running its own operating system, on a given host machine. Figure 1 provides an overview of this basic Virtual Server architecture.
Figure 1 Virtual Server 2005 Architecture
Notice that there are four operating systems (one host OS and three virtual machines) running on the same server hardware. Each VM is completely self-contained in that the OS believes it is running on physical hardware. The virtualization layer, in this case the Virtual Server 2005 service, translates all calls from within the VMs to actual physical hardware.
If you’re like most systems administrators, the burning question that comes to mind is: what kind of performance can I expect? There is obviously going to be CPU, memory, disk, and network overhead when using any form of virtualization (this is sometimes referred to as the "Virtualization Tax"). While there’s no single number that would reflect the performance impact, you’re likely to find virtualization to be a viable solution for all but your most heavily used servers. Of course, scalability and performance testing is critical to a successful deployment. Rest assured, however, that there are many organizations using virtualization for mission-critical enterprise applications. Oh, and you can play old MS-DOS®-based games like Doom and Gauntlet within a virtual machine, as well. The sidebar "The Benefits of Virtualization" elaborates on many of these benefits.
Virtual Server 2005 runs on Windows Server 2003 and Windows® XP Professional (though running on Windows XP is not supported for production use). Note, however, that if you only want to host one or a few virtual machines on a single workstation, Virtual PC may suit your needs. Virtual Server 2005 uses a Web-based administration interface, so you’ll need to either run IIS on the host machine or install the included vmrc.exe admin application on the workstation from which you’ll manage the virtual servers.
Overall VM performance will be determined primarily by physical CPU, memory, and hard disk specifications of your host computer. Microsoft supports a variety of Intel and AMD CPUs in single and multiprocessor configurations. With the R2 release of Virtual Server 2005, support was also added for x64-based Windows host operating systems (though the guest operating systems are still 32-bit). The minimum supported CPU speed is 550 MHz, with a minimum recommended speed of 1.0 GHz or higher. You’ll likely need faster CPUs based on your guest OS requirements. The "Virtual Machine Specs" sidebar shows the specifica-tions of the emulated hard-ware configuration.
Installing and Configuring
When planning for VM deployment, physical RAM in the host server will be the most important constraint. First, estimate how much memory each guest OS will need. Then keep in mind that Virtual Server 2005 requires a physical amount of 32MB of memory in addition to what you configure. Also note that you cannot over commit memory—that is, the sum of all of the memory allocated to running VMs cannot exceed the total physical memory available on your server (regardless of whether the allocated memory is being fully utilized). The theoretical limit is 64 VMs per host server, although that number is completely dependent on available system resources.
Installing Virtual Server 2005 is simple—the installer does all the work for you. Before you begin the installation, make sure that you have an IIS Web server available (or installed on the local server). During installation, a new Virtual Server Administration Web site will be configured (on port 1024, by default). Additionally, the Virtual Server service will be added to the machine. To access the Virtual Server, you can use the Virtual Server Administration Web site shortcut icon, or you can connect to ServerName:PortNumber/VirtualServer/VSWebApp.exe. Figure 2 shows the main Virtual Server 2005 administration interface.
Figure 2 Virtual Server Administration Web Site
For the most part, Virtual Server 2005 is ready for use in its default configuration. However, there are some settings you might want to change. First, you will probably want to enable the Virtual Machine Remote Console (VMRC). You can use this ActiveX® control to interact with virtual machines during the installation process. Next, you should configure Search Paths on the server. These locations will specify where VM hard disks and configuration files are to be stored. Additionally, you can configure VM startup options and the automatic refresh interval for the Web site.
Setting Up Virtual Machines
In many ways, you should treat virtual machines the same as physical ones. Each VM requires its own operating system license and will likely require the same administration and maintenance as a physical server. The process of creating a new VM is quite simple. Just use the Create option under Virtual Machines in the left-hand pane of the admin interface. Here you’ll have the option of naming the VM and specifying basic memory, virtual hard disk, and network settings (see Figure 3).
Figure 3 Creating a New Virtual Machine
The next step is to install an operating system. As with physical computers, you can install the OS manually using media. Virtual Server 2005 allows you to attach the VM to most ISO disk image files or to connect directly to the host’s floppy, CD, or DVD drive. To save time, you can use all of the standard Microsoft Automated Deployment Services (ADS) tools and techniques to speed up the process.
After installing the guest OS on the VM, you should install Virtual Machine Additions. This provides improved overall performance on supported operating systems, as well as additional features such as clean guest OS shut down functionality from within the admin console, and synchronization between the guest and host BIOS clocks. It’s also very helpful to enable remote administration on your guest operating system if it’s supported. While you can continue to use the VMRC to access the VM, it can be easier to use a Remote Desktop Protocol-based connection to do your work.
At this point, your VM is ready for use, and you can practically forget that it’s virtual. Set up the machine as you would any other server or workstation in your environment. That includes making sure the VM’s guest OS has all current service packs and updates. Once you’ve finished all of this installing, updating, and configuring, make a copy of this VM’s Virtual Hard Drive (.vhd) file to use it as a template for future deployments (though remember the earlier caveat, that each instance must abide by the licensing requirements as a physical machine).
Administering Virtual Machines
You can easily edit the virtual hardware configuration of a VM by using the Web-based administration tool. Figure 4 shows the options that are available. From here, you can add additional hard disks, configure network adapters, and fine-tune the amount of memory. Some changes can be performed while the system is running, but others will require that the VM be shut down.
Figure 4 Virtual Machine Properties
In addition to turning a VM on and off, you have several other useful options. Reset is similar to powering on and off a physical machine. Generally, you’ll want to use Shut Down Guest OS (which gracefully shuts down a Windows-based guest operating system) or Save State (which is similar to putting the computer in standby mode). Of course, you can also use commands within the guest OS such as Shut Down, Restart, Stand by, and Hibernate.
You can easily move VMs between installations of Virtual Server 2005. First, take note of the location of the VM’s configuration files. By default, the folders you’ll need are located within the C:\Documents and Settings\All Users\Documents\ folder), and the location of all of the disk-related files required for the VM. Before you move a VM, you must shut it down or save its state. Then the operation is as simple as copying the files to the destination Virtual Server and using the Add Virtual Machines operation to point the server to the appropriate .vmc configuration file. Note that if the path to the .vhd files has changed, you may need to specify the new locations of the .vhd files manually. Also keep in mind that the source and destination services must be using the same processor type, and that if the destination server has drastically different available resources, you may want to adjust your guest OS configurations.
Figure 6 Differencing Disk Hierarchy
Virtual Hard Disks
While the various options might be a little confusing at first, much of the flexibility and power of Virtual Server comes from the ability to configure its virtual hard disks. Virtual disks can be attached to virtual IDE or SCSI controllers. Virtual Server 2005 supports four types of virtual hard disk as shown in Figure 5.
Figure 5 Virtual Hard Drive Types
||Allocates physical disk space on the host only when the guest OS uses it. You can configure a 10GB hard disk for a virtual machine, but it might only take up 3GB of disk space on the host OS.
||Takes up the amount of physical hard disk space that is allocated. Since there’s no overhead related to expanding the file, fixed-size disks can offer improved performance.
||Points to an entire physical hard disk on the host computer. This option is primarily intended for the process of converting an existing physical hard disk to a virtual hard disk.
||Saves changes in a separate file to keep permanent changes from being written directly to your virtual disk.
||Creates a hierarchy of disks by writing all differences to a new virtual disk.
When shutting down a VM with undo disks enabled, you can choose whether you want to keep, commit, or discard changes to the virtual machine. Differencing disks are created for individual virtual hard disks, but they do not allow for automatically rolling back changes.
Differencing disks offer you the ability to create a base .vhd (including just an OS, for example), and then write all differences to a new virtual disk. The differencing disk might contain alternate applications or configurations. This can lead to some complex and powerful scenarios. Figure 6 provides an example of how differencing disks can be used to create a hierarchy. You can use the Inspect Virtual Disks command to convert hard disk types (for example, between fixed and dynamic types), and to compact dynamic virtual disks to reclaim unused space.
Virtual Server offers flexible network configuration options. Each VM can be given up to four network adapters, and each adapter can be connected to a separate virtual network. When creating a new virtual network, you can attach the virtual network to a physical network adapter on the host computer. This will make the VM a part of that physical network, so be sure that you set up compatible and unique IP addresses. You can also create a virtual network that allows VMs to communicate only with each other, or disable networking altogether.
Virtual Server 2005 also provides a built-in Dynamic Host Configuration Protocol (DHCP) server that can be enabled to simplify network configuration (see Figure 7). You can even manually specify media access control (MAC) addresses for each virtual network interface card (NIC) through each VM’s individual configuration settings.
Figure 7 Configuring DHCP Properties
Virtual Server offers many different options for configuration and allocating system resources. You can use Performance Monitor counters to monitor both the host and Windows-based guest operating systems. In addition, Virtual Server 2005 provides two Windows Management Instrumentation (WMI)-based objects: VirtualMachine for monitoring disk, memory, CPU, and other performance statistics within a virtual machine, and VirtualNetwork for monitoring network-related statistics.
You can manage CPU load using the Resource Allocation page in the Virtual Server administration site. Using this interface, you can specific the amount of total processor capacity that will be available to each VM.
On the network side, using Gigabit Ethernet network interface cards can dramatically improve overall performance. Even though the guest OS emulates a 100Mb connection, when you have multiple VMs running, the performance increase will be noticeable.
In many virtual environments, disk throughput can be a significant bottleneck because you have multiple virtual operating systems, each of which is unaware of the others, competing for the same disk resources. On the host server, standard parallel IDE hard disks will perform at the bottom of the heap, Serial-ATA will perform better, and SCSI hard disks will usually give the best performance. You can dramatically improve disk performance by using RAID-based file systems, adding more independent disk spindles and controllers, or by investing in network-based storage systems. While the RTM version of Virtual Server 2005 does not provide native support for these technologies, you can use a Storage Area Network (SAN), Network Attached Storage (NAS), and file servers to store .vhd, .vmc, and other configuration files and resources. While you might realize useful performance and manageability improvements, you should thoroughly test these scenarios before using them in a production environment.
Scripting and Automation
While the Web-based administration tool is fine for setting up a few VMs on a few servers, you might want to automate or schedule various options. Fortunately, Virtual Server 2005 supports an API that allows you to script common operations. The object model is documented in the Virtual Server Programmer’s Guide, which is installed by default when you install Virtual Server 2005.
Here’s a simple script to start all of the VMs on a local server:
Set objVirtualServer = CreateObject( _
Set colVirtualMachines = _
For Each objVirtualMachine in _
This script loops through the collection of VMs, sending a start command to each. A brief 10-second pause is added to help avoid bogging down the server. Of course, you can also create full Virtual Server-based applications easily using COM interoperability in the Microsoft .NET Framework. You should note, however, that there are special COM security-related considerations to keep in mind when building an automation application.
You can also create command-line scripts that run when specific VM events occur. For example, you might want to send a notification when a VM is powered off, or when it experiences a low disk space error (either within the guest OS or outside of it). These options can be set within the Scripts properties of each VM.
As with all other applications and operating systems in your environment, you should be sure that guest OSs are kept up-to-date and that they’re backed up properly. Regarding the host operating system (and Virtual Server 2005 itself), most options are based on file system and OS security. Figure 8 shows the options available in the Virtual Server Properties security settings.
Figure 8 Virtual Server Security
In general, you can enhance security in your Virtual Server 2005 installation by using NTFS file system permissions on configuration files, including VM configuration (.vmc), network configuration (.vnc), and virtual disk-related files (.vhd, .vnc, and .vsv).
You can also boost security by limiting access to the Virtual Server Administration Web site through IIS (details are available in the Virtual Server online help). This includes setting user access permissions and TCP port settings. Finally, there’s no substitute for good policies—ensure that all VMs that are attached to your production networks adhere to the same security requirements as your physical machines.
Manage your virtual machines as you would any other physical machine in your environment. All of the management tasks you can accomplish through event logs, WMI, Microsoft Operations Manager (MOM), and Systems Management Server (SMS) can be applied to VMs. Similarly, you should comply with update and security policies on VMs as you would for any other machine.
Back up your VMs. This can be tricky because the .vhd files associated with a running VM cannot be backed up directly (though this has been improved in the R2 release). Your options are to save the state or shut down the VM before backing it up from the host (which will result in some downtime), or to configure backups to occur from within the OS running on the VM.
In the event of a server failure, you should have a plan for restoring your VMs. In the case of complete data loss on a server, the quickest method might be to reinstall Virtual Server on another machine and to restore the latest available virtual disks and configuration files. Note however, that the R2 release of Virtual Server 2005 now supports host system clusters, which will provide a high availability scenario in the event of a system failure.
Configure your antivirus and other software to exclude standard Virtual Server and related files (.vhd, .iso, and so on). These files tend to be very large, and normal scanning operations can dramatically reduce host and VM performance.
If you’re using Virtual Server for testing, create a separate network environment. You can use a Virtual Private Network (VPN) connection to transfer files to and from your production networks, if required.
The Virtual Future
Microsoft Virtual Server 2005 provides powerful virtualization technology today, and the solutions will only get better. Whether you use Virtual Server for hosting legacy systems, utilizing hardware efficiently, or testing, it’s difficult to overlook the many potential benefits of virtualization.
It’s not difficult to imagine wanting more than the rather modest hardware specifications of the current VM. Work is being done to virtualize more types of devices available on the host operating system. You can also expect increased VM performance through hardware-based Hypervisors, a layer of software that sits between the OS and your hardware, and that allows for running multiple OSs simultaneously without the need for, and associated overhead of, a complete host OS. Intel and AMD both have plans to provide CPU-level virtualization technologies that will improve performance.
In the longer term, Microsoft plans to add virtualization and Hypervisor support into the Windows kernel, starting with Windows Vista™ and the next version of Microsoft Windows Server, code-named "Longhorn." These hardware-based solutions will provide improved performance and support for thousands of different types of hardware devices.
Anil Desai is an independent consultant based in Austin, TX. He is an MVP and the author of numerous technical books focusing on the Windows Server platform, Active Directory, SQL Server 2000, and IT management. Contact Anil through his Web site.
© 2008 Microsoft Corporation and CMP Media, LLC. All rights reserved; reproduction in part or in whole without permission is prohibited