Howto Install Windows XP / Vista on Xen

This short guide describes how to install Windows XP or Windows 2003 Server on Xen. It provides an overview of the Debian Linux Etch installation, and detailed steps for installing and configuring Xen and starting the Windows XP or Windows 2003 Server
installation.

Requirements

  • CPU with either Intel’s Vanderpool (IVT – Intel Virtualization Technology) orAMD’s Pacifica Technology (AMD virtualization)
  • Windows iso-image

First you need to install Xen on Debian Etch:

sudo apt-get install xen-linux-system-2.6.18-4-xen-686 libc6-xen bridge-utils

Boot into the newly installed Xen enabled Linux kernel

sudo reboot

Then adjusted the network settings in /etc/xen/xend-config.sxp. Enabling the network bridge:

(network-script network-bridge)

Install Xen IO Emulation tools:

sudo apt-get install xen-ioemu-3.0.3-1

Create a directory for the virtual machine files e.g. /home/xen/domains/win01 and create a disk image for the virtual machine’s primary disk.

mkdir /home/xen
mkdir /home/xen/domains
mkdir /home/xen/domains/win01
sudo dd if=/dev/zero of= /home/xen/domains/win01/disk.img bs=1M count=4096

Establish a Xen machine Configuration file (/etc/xen/win01.cfg) like this

kernel = '/usr/lib/xen/boot/hvmloader'
builder = 'hvm'
memory = '256'
device_model='/usr/lib/xen/bin/qemu-dm'

# Disks
disk = [ 'file:/home/xen/domains/win01/disk.img,ioemu:hda,w',
'file:/home/cc/iso-images/WindowsXP-SP2/image.iso,ioemu:hdc:cdrom,r' ]

# Hostname
name = ‘win01′

# Networking
vif = ['type=ioemu, bridge=xenbr0']

# Behaviour
boot='d'
vnc=1
vncviewer=1
sdl=0

The ready to fire up the new machine and start the Windows installation in a vnc terminal.

xm create win01.cfg

After the virtual machine is started – a VNC server port should be available on port 5900 at the Xen server’s IP, e.g. 192.168.1.102 – A VNC XEN Client session is depicted here.

If an error like this shows up

Error: Device 0 (vif) could not be connected. Backend device not found.

You should check your that you have enabled the network bridge, “(network-script network-bridge)”, in /etc/xen/xend-config.sxp and restarted the xen deamon by /etc/init.d/xend restart

For more on creating Xen virtual machines read this guide, which outlines the features of the xen-tools package.

Comments

Howto: Resize Xen Loop Disk Image

Win4lin, KVM, QEMU, Virtualbox and Xen are all widely used technologies, used in virtual servers. Fairly often a virtual server run from within a loop filesystem and generally start with a fairly small file (1GB is big for a normal file, but not when it is pretending to be an entire filesystem!)

However things often grow over time.

Here is a nice simple procedure for increasing the size of a loop filesystem, if the filesystem is ext2 or ext3 (the procedure should work for ext4 too, but I havn’t tested it yet)

1. Stop the virtual server that is using the loop filesystem
2. Add some extra space to your loop filesystem file
# dd if=/dev/zero bs=1024k count=1024 >> loop_image_file

This adds 1GB to the end of a file called loop_image_file (make sure to use the append output redirector >> not a single >, otherwise you’ll have an empty 1GB file!)

3. Force a check on the resized/increased filesystem
# e2fsck -f loop_image_file

4. Resize the filesystem within the loop filesystem file
# resize2fs loop_image_file

5. Start the virtual server again

Comments off

Xen Howto: Install Windows

This short guide describes how to install Windows XP orWindows 2003 Server on Xen. It provides an overview of theDebian Linux Etch installation, and detailed steps for installing and configuring Xenand starting the Windows XP or Windows 2003 Server
installation.

Requirements

  • CPU with either Intel’s Vanderpool (IVT – Intel Virtualization Technology) orAMD’s Pacifica Technology (AMD virtualization)
  • Windows iso-image

First you need to install Xen on Debian Etch:

sudo apt-get install xen-linux-system-2.6.18-4-xen-686 libc6-xen bridge-utils

Boot into the newly installed Xen enabled Linux kernel

sudo reboot

Then adjusted the network settings in /etc/xen/xend-config.sxp. Enabling the network bridge:

(network-script network-bridge)

Install Xen IO Emulation tools:

sudo apt-get install xen-ioemu-3.0.3-1

Create a directory for the virtual machine files e.g. /home/xen/domains/win01 and create a disk image for the virtual machine’s primary disk.

mkdir /home/xen
mkdir /home/xen/domains
mkdir /home/xen/domains/win01
sudo dd if=/dev/zero of= /home/xen/domains/win01/disk.img bs=1M count=4096

Establish a Xen machine Configuration file (/etc/xen/win01.cfg) like this

kernel = '/usr/lib/xen/boot/hvmloader'
builder = 'hvm'
memory = '256'
device_model='/usr/lib/xen/bin/qemu-dm'

# Disks
disk = [ 'file:/home/xen/domains/win01/disk.img,ioemu:hda,w',
'file:/home/cc/iso-images/WindowsXP-SP2/image.iso,ioemu:hdc:cdrom,r' ]

# Hostname
name = ‘win01′

# Networking
vif = ['type=ioemu, bridge=xenbr0']

# Behaviour
boot='d'
vnc=1
vncviewer=1
sdl=0

The ready to fire up the new machine and start the Windows installation in a vnc terminal.

xm create win01.cfg

After the virtual machine is started – a VNC server port should be available on port 5900 at the Xen server’s IP, e.g. 192.168.1.102 – A VNC XEN Client session is depicted here.

If an error like this shows up

Error: Device 0 (vif) could not be connected. Backend device not found.

You should check your that you have enabled the network bridge, “(network-script network-bridge)”, in /etc/xen/xend-config.sxp and restarted the xen deamon by /etc/init.d/xend restart

For more on creating Xen virtual machines read this guide, which outlines the features of the xen-tools package.

Comments off

Installing Xen on Debian Etch 4.0

For a long time I have tested many different virtualization techniques; Xen, VMWare, and Microsoft VM. Until now I’m able to conclude that all of them are usable on my desktop machine, but bothVMWare and Microsoft’s VM are more sluggish that Xen. This weekend I deployed my first server based on the upcoming Debian Etch andXen. Everything worked out of the box.

Here is what I did to install Xen on Debian Etch:

sudo apt-get install xen-linux-system-2.6.18-4-xen-686 libc6-xen bridge-utils

Boot into the newly installed Xen enabled Linux kernel

sudo reboot

Then adjusted the network settings in /etc/xen/xend-config.sxp. Enabling the network bridge:

(network-script network-bridge)

Install xen-tools:

apt-get install xen-tools

Xen tools is a collection package containing different tools related to Xen, a virtual machine creator etc.

Edit adjust the kernel and initrd parameters in /etc/xen-tools/xen-tools.conf to match the ones on your system:

Find out what the kernel image and initrd is named by:

ls /boot/vmlinuz*
/boot/vmlinuz-2.6.18-4-686 /boot/vmlinuz-2.6.18-4-xen-686

and

ls /boot/initrd*
/boot/initrd.img-2.6.18-4-686 /boot/initrd.img-2.6.18-4-686.bak /boot/initrd.img-2.6.18-4-xen-686

Adjust the lines

#
# Default kernel and ramdisk to use for the virtual servers
#
kernel = /boot/vmlinuz-2.6.18-4-xen-686
initrd = /boot/initrd.img-2.6.18-4-xen-686

Further adjust the xen-tools.conf to this settings:

dir = /home/xen
debootstrap = 1
size = 4Gb # Disk image size.
memory = 128Mb # Memory size
swap = 128Mb # Swap size
fs = ext3 # use the EXT3 filesystem for the disk image.
dist = etch # Default distribution to install.
image = sparse # Specify sparse vs. full disk images.

Create a home for all the coming virtual Xen guests:

mkdir /home/xen
mkdir /home/xen/domains

And then ready to create a virtual machine – guest, simply by:

xen-create-image -hostname=mailserver -ip=10.0.0.21 -netmask=255.255.255.0 -gateway=10.0.0.1 -passwd

Afterwards I was able to fire up the newly created virtual machine with:

xm create mailserver.cfg

If an error like this shows up

Error: Device 0 (vif) could not be connected. Backend device not found.

You should check your that you have enabled the network bridge, “(network-script network-bridge)”, in /etc/xen/xend-config.sxp and restarted the xen deamon by /etc/init.d/xend restart

When up and running either “xm list” or “xentop” can be used to get an overview of what instance are currently running

debian5:# sudo xm list
Name                                      ID Mem(MiB) VCPUs State   Time(s)
Domain-0                                   0      874     1 r-----    657.9
mailserver                                 3      128     1 -b----      8.0

Based on my experiences so far with virtualization and deploying virtualization in a enterprise setup, I really think that Xen is a very strong asset for Linux and Linux based distributions to show the world what they are up to. Virtualization is really a technique for enterprise server and data center managers to make a more robust and simplified setup, and I think that virtualization could play a significant role within the server market the coming years.

Comments