Virtualizing Windows Server 2008 with Xen

From Virtuatopia

Jump to: navigation, search
PreviousTable of ContentsNext
Installing and Running Windows XP or Vista as a Xen HVM domainU GuestInstalling and Running Windows 7 as a Xen HVM domainU Guest


Purchase and download the full PDF and ePub versions of this eBook for only $8.99  Add to Cart


This chapter of Xen Virtualization Essentials will cover in detail the steps necessary to install and run Windows Server 2008 as a virtualized Xen guest.

Since Windows Server 2008 falls into the Xen category of an unmodified operating system (in other words an operating system that has not been altered specifically to run on the Xen hypervisor) paravirtualization is not an option. The best way, therefore, to virtualize Windows Server 2008 using Xen is to configure it as a Hardware Virtual Machine (HVM) guest. For information about the differences between paravirtualization, hardware virtualization and full virtualization read the chapter entitled An Overview of Virtualization Techniques.

Contents


[edit] Requirements for Xen Windows Server 2008 Virtualization

This chapter assumes that the Xen host system is running a Xen enabled kernel and that the standard Xen tools (specifically xm) are also installed. In addition, hardware virtualization requires that the host system hardware include either Intel-VT or AMD-V virtualization support. In order to verify this run the following commands on the host system:

For Intel CPUs:

grep vmx /proc/cpuinfo

For AMD CPUSs:

grep svm /proc/cpuinfo

If neither of the above commands produce output then it is likely these features are unavailable and that your hardware is unable to run Xen HVM guests. It is also possible that the host CPU supports one of these features, but that the functionality is disabled by default in the system BIOS. To verify this, access the host system’s BIOS configuration menu during the boot process and look for an option related to virtualization support. If such an option exists and is disabled, enable it, boot the system and repeat the above commands.

[edit] Windows Server 2008 Installation Media

In order to install Windows Server 2008 as a Xen HVM guest the second requirement is the operating system installation media. This is likely to be in the form of a DVD. Installation may be performed directly from the DVD, or the contents of the DVD may be copied to an ISO image file on the host system.

To create an ISO image simply insert the DVD into a drive, unmount it if it automounts and then run the following command (substituting /dev/cdrom for your DVD drive device):

dd if=/dev/cdrom of=windows2008.iso

[edit] Preparing Storage Space for Windows Server 2008

Obviously, the Windows Server 2008 guest system will need disk space into which it can install itself and subsequently execute. This space can take the form of either a physical disk drive connected to the host system or a disk image file. If a physical disk drive is available for the guest make a note of the device name. This is typically a device beginning with /dev/sd or /dev/hd followed by a letter (for example /dev/sdc or /dev/hdb).

If a disk image is required one may be created using the dd command-line tool:

dd if=/dev/zero of=xenwin2008.img bs=1024k seek=10000 count=0

The above command creates a 6Gb image file named xenwin2008.img.

[edit] Creating the Xen Windows Server 2008 Configuration File

The next step involves the creation of a domainU configuration file suitable for installing Windows Server 2008 as a Xen guest.

The following file is an example configuration file with the minimal settings required for a Windows Server 2008 Xen guest:

import os, re
arch = os.uname()[4]
if re.search('64', arch):
    arch_libdir = 'lib64'
else:
    arch_libdir = 'lib'

kernel = "/usr/lib/xen/boot/hvmloader"
builder='hvm'
memory = 1024

# Should be at least 2KB per MB of domain memory, plus a few MB per vcpu.
shadow_memory = 8
name = "xenwin2008"
vif = [ 'type=ioemu, bridge=xenbr0' ]
acpi = 1
apic = 1
disk = [ 'file:/home/xen/xenwin2008.img,hda,w', 'file:/home/xen/windows2008.iso,hdc:cdrom,r' ]

device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm'

#-----------------------------------------------------------------------------
# boot on floppy (a), hard disk (c) or CD-ROM (d) 
# default: hard disk, cd-rom, floppy
boot="dc"
sdl=0
vnc=1
vncconsole=1
vncpasswd=''

serial='pty'
usbdevice='tablet'

The above example assumes that Windows Server 2008 is going to be installed into a disk image and that the installation media is an ISO image file. If, on the other hand, a physical disk is to be used the disk directive might appear as follows (where /dev/sdb is replaced with the appropriate physical device name):

disk = [ 'phy:/dev/sdb,hda,w', 'file:/home/xen/windows2008.iso,hdc:cdrom,r' ]

Similarly, the disk = directive can be modified to perform the installation from a physical DVD drive as in the following example (where /dev/cdrom is modified to reflect the physical device on your host system):

disk = [ 'phy:/dev/sdb,hda,w', 'phy:/dev/cdrom,hdc:cdrom.r' ]

The above line maps physical disk drive /dev/sdb on the host to /dev/hda on the guest and /dev/cdrom on the host as the CD/DVD device on the guest (note that the CD/DVD device name on your host may be different depending on your Linux distribution).

Alternatively, if a disk image file is to be used as the disk drive the line might instead read:

disk = [ 'file:/home/xen/xenwin2008.img,hda,w', 'phy:/dev/cdrom,hdc:cdrom,r' ]

A number of the configuration settings shown in the above example are to enable a graphical console for our Windows Server 2008 guest operating system. Xen provides a choice of VNC or SDL for supporting a graphical console when the guest is running. For example the following settings select VNC:

vnc = 1
sdl = 0

whilst the following selects SDL:

vnc = 0
sdl = 1

Both SDL and VNC work very well in terms of displaying Windows in a graphical console, although VNC has some distinct advantages over SDL. Firstly, VNC provides greater flexibility than SDL in terms of remote access to the domainU graphical console. With VNC it is possible to connect to the graphical console from other systems, either on the local network or even over the internet. Secondly, when you close a VNC viewer window the guest domain continues to run allowing you to simply reconnect to carry on where you left off. Closing an SDL window, however, immediately terminates the guest domainU system resulting in possible data loss.

By default Xen does not automatically start the VNC console when the domainU guest starts up. In order to have the graphical console spawned automatically, the vncconsole = 1 setting is included.

vncconsole=1

A number of other configuration options are available to modify the guest environment but the above settings are the minimal settings recommended to run a Windows guest with Xen. Once the configuration file is complete save it as xenwin2008.cfg.

[edit] Starting the Xen Windows Server 2008 HVM Guest

With the configuration complete the next step is to start up the Xen guest environment:

xm create xenwin2008.cfg
Using config file "./xenwin2008.cfg".
Started domain xenwin2008

After a few seconds the VNC or SDL console (depending on the configuration settings) will appear and the Windows installation process will begin. The following figure shows the Windows Server 2008 installation running in a VNC window:


Windows Server 2008 installation viewed using VNC


The following figure shows an installed Windows Server 2008 instance running as a Xen HVM guest:


Windows Server 2008 running as a Xen HVM guest


Purchase and download the full PDF and ePub versions of this Xen eBook for only $8.99

Add to Cart



PreviousTable of ContentsNext
Installing and Running Windows XP or Vista as a Xen HVM domainU GuestInstalling and Running Windows 7 as a Xen HVM domainU Guest