Posts Tagged ‘windows’

Running Windows on Eucalyptus

August 5, 2009

This post has now been superseded.  See here for the update.

This post details how to create a Microsoft Windows image to run on a Eucalyptus instance with nodes running running KVM. In my example, I’ve created an XP image; a similar methodology can be used for Server 2003 and other NT versions.

The approach should theoretically also work on paravirtualised Xen nodes, though I haven’t tried it!

Windows XP running on Eucalyptus

Windows XP running on Eucalyptus

Create the base image

You first need to create a Windows base image using KVM.  There are already plenty of how-tos around explaining this process, so I won’t go into any detail here.  The critical part is that the install should be onto a SCSI disk image, as this is what Eucalyptus expects.

Generate the bootloader kernel

For this step, you’ll need to download and compile the memdisk component of syslinux.

Syslinux can be downloaded from .  I just grabbed the latest version.  Extract the archive, switch to the syslinux-<version>/memdisk directory, and compile memdisk using make.  You’ll need to install nasm first, as this is a dependency; to do this on Ubuntu, type:

# sudo apt-get install nasm

Make will compile a number of files into the memdisk directory – you’ll just need the one called memdisk

Create the bootloader ramdisk

This is the interesting part.  Basically, we’re going to create a Windows boot image, which will then launch the Windows virtual machine itself.

First, create a blank virtual floppy disk, using:

# dd bs=512 count=2880 if=/dev/zero of=win-boot.img

Now, attach this image as a floppy drive to the Windows VM you created above, and start the instance.  Format the disk either by right-clicking on the floppy drive icon in My Computer, or through a terminal using format a: (mkfs.msdos doesn’t work here, as the resulting file system isn’t bootable).

Finally, copy the following 4 files from the root of the windows c:\ to the floppy disk:


(for the above in greater depth, see: )

Bundle the image

Create the eucalyptus bundles using the same method as for a linux image.  You’ll need the memdisk and win-boot.img files you’ve just created, together with the hard disk image file from the Windows KVM virtual machine.

The command sequence (assuming you have the EC2 tools set up correctly) should be:

mkdir kernel
ec2-bundle-image -i /path-to/memdisk -d ./kernel --kernel true
ec2-upload-bundle -b kernel -m ./kernel/memdisk.manifest.xml
EKI=`ec2-register kernel/memdisk.manifest.xml | awk '{print $2}'`
echo $EKI
mkdir ramdisk
ec2-bundle-image -i /path-to/win-boot.img -d ./ramdisk --ramdisk true
ec2-upload-bundle -b ramdisk -m ramdisk/win-boot.img.manifest.xml
ERI=`ec2-register ramdisk/win-boot.img.manifest.xml | awk '{print $2}'`
echo $ERI
mkdir image
ec2-bundle-image -i path-to/<windows_disk>.img -d ./image --kernel $EKI --ramdisk $ERI
ec2-upload-bundle -b image -m ./image/<windows_disk>.manifest.xml
EMI=`ec2-register image/<windows_disk>.manifest.xml | awk '{print $2}'`
echo $EMI

And that’s it!