Open Thoughts

Kiran Murari

Subscribe to Kiran Murari: eMailAlertsEmail Alerts
Get Kiran Murari: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn

Related Topics: Cloud Computing, Cloudonomics Journal, Intel XML, XML Magazine, FDA News, CIO/CTO Update

Blog Feed Post

UEC: Bundling Windows Image

Creating new disk image

This will be the main HDD in the virtual image, so make sure to give it as much space as you’ll need. Since we’re building a kvm image, we can use a qcow2 format for disk images. Qcow2 is an expandable image format, so it’ll only take as much storage space as it’s actually used within the image.

$ kvm-img create -f qcow2 win-2k3.img 20G

OS Installation

Get the iso file of the Windows distribution to be installed in the image. And start the installation process.

$sudo kvm -m 1024 -cdrom Win2003_cd1.iso -drive file=win-2k3.img,if=scsi,boot=on -nographic -vnc :0

After finishing the installation and in case the installation needs 2nd CD as well, reboot the VM and launch the VM by the following command.

$ sudo kvm -m 1024 -boot c -cdrom Win2003_cd2.iso -drive file=win-2k3.img,if=scsi,boot=on -nographic -vnc :0

Once installation is complete, create the boot disk needed for Windows 2003 server.

Copying the boot files

Re-launch the VM using the following command, so that the first CD can be accessed in order to copy some files from it.

$ sudo kvm -m 1024 -boot c -cdrom Win2003_cd1.iso -drive file=win-2k3.img,if=scsi,boot=on -nographic -vnc :0

Copy ntldr, and sym_hi.sys files from CD1, to a specific location to create the boot disk, say C:\bootfiles

Rename sym_hi.sys to Ntbootdd.sys (this is the SCSI driver needed to boot the hard disk). In case, sym_hi.sys is not present in the CD, copy it from the following location of the installation


Write the following lines to a new file and save it as Boot.ini in the same location, i.e, C:\bootfiles

[boot loader]
Default= multi(0)disk(0)rdisk(0)partition(1)\Windows

[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003"

Shut down the VM and proceed for the boot disk creation.

Boot disk creation

On CC, execute the following command to create the boot disk.

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

Now attach this disk as a floppy disk and start the Windows VM.

$ sudo kvm -m 1024 -boot c -drive file=win-2k3.img,if=scsi,boot=on,index=1 -fda win-boot.img -nographic -vnc :0

On the Windows VM, format the floppy disk and copy all the files from C:\bootfiles to the floppy.
Shutdown the VM and test the boot disk created with the following command

$ sudo kvm -m 1024 -boot a -drive file=win-2k3.img,if=scsi,boot=on,index=1 -fda win-boot.img -nographic -vnc :0

This should boot into windows, if the boot floppy is properly created.

Network Configuration

Now download the e1000 drivers, since e1000 is the default interface that is supported by Eucalyptus. Download the drivers from the following location:
e1000 Drivers Download

For 32-bit VM, download PRO2KXP.exe
For 64-bit VM, download PROEM64T .exe

Once the download is finished, shutdown the VM and restart the VM with the following command.

$ sudo kvm -m 1024 -boot a -drive file=win-2k3.img,if=scsi,boot=on,index=1 -fda win-boot.img -nographic -vnc :0  -net nic,model=e1000

The above command tell the VM to make use of e1000 model as its NIC. After executing the above command, the following warning is seen on the console which can be ignored.

Warning: vlan 0 is not connected to host network

Once the VM boots, install the network drivers.

Enable remote desktop for all users on the VM. This is needed, as this is the only way, without installing third party tools, Windows machines can be accessed remotely. Enable remote desktop by navigating to Start → Settings → Control Panel → System → Remote and select “Remote Desktop” option for all users. This completes the Windows disk setup. Shut down the VM.


The kernel memdisk can be used to load Windows. The default syslinux memdisk can be used for this purpose. memdisk is present in /usr/lib/syslinux

If it is not present, install syslinux by the following command.

$ sudo apt apt-get install syslinux

After installing, memdisk will be found in /usr/lib/syslinux

$ cd /usr/lib/syslinux
$ ls -l memdisk
-rw-r--r-- 1 root root 20068 2008-07-15 20:25 memdisk

Copy it to the location where all windows files are present, i.e., win-2k3.img and win-boot.img

Registering with UEC

The last step would be to upload the images to UEC. The files that need to be uploaded are:

  • memdisk
  • win-boot.img
  • win-2k3.img

Before starting the upload process shut down the VM.

Registering memdisk

Execute the following commands to bundle and register the memdisk.

$ euca-bundle-image -i memdisk --kernel true
$ euca-upload-bundle -b win2k3_bucket -m /tmp/memdisk.manifest.xml
$ euca-register win2k3_bucket/memdisk.manifest.xml

Save the output produced by the last command above (eki-XXXXXXXX), which will be needed while registering the disk image.

Registering boot disk

Execute the following commands to bundle and register the boot disk (win-boot.img).

$ euca-bundle-image -i win-boot.img --ramdisk true
$ euca-upload-bundle -b win2k3_bucket -m /tmp/win-boot.img.manifest.xml
$ euca-register win2k3_bucket/win-boot.img.manifest.xml

Save the output produced by the last command above (eri-XXXXXXXX), which will be needed while registering the disk image.

Registering disk image

Execute the following commands to bundle and register the disk image (win-2k3.img)

$ euca-bundle-image -i win-2k3.img --kernel eki-XXXXXXXX --ramdisk eri-XXXXXXXX
$ euca-upload-bundle -b win2k3_bucket -m /tmp/win-2k3.img.manifest.xml
$ euca-register win2k3_bucket/win-2k3.img.manifest.xml

Replace eki-XXXXXXXX and eri-XXXXXXXX with the exact values as noted down earlier.

Image Listing

The new images that have been uploaded can be seen by using euca-describe-images command.
For Ex:

$ euca-describe-images
IMAGE   emi-55470DE2    win-2k3/win-2k3.img.manifest.xml        admin   available    public  x86_64  machine
IMAGE   eki-2BC30D1B    win-2k3/memdisk.manifest.xml    admin   available   public   x86_64  kernel
IMAGE   eri-76C20ED5    win-2k3/win-boot.img.manifest.xml       admin   available    public  x86_64  ramdisk

Security Group

Verify that the security group to be used with this instance is allowing RDP traffic.

$ euca-describe-groups
GROUP   admin   default default group
PERMISSION      admin   default ALLOWS  tcp     3389    3389    FROM    CIDR0.0.0.0/0

If the above entry is not present, allow RDP with the following command.

$ euca-authorize default -P tcp -p 22 -s

Running the instance

To launch a new instance of the custom image, execute euca-run-instances command.

$ euca-run-instances  emi-55470DE2 -k mykey -t c1.xlarge

Since this is a windows instance the VM type is specified as c1.xlarge, which has 20GB of hard disk space. Also specifying the key is not mandatory, as the access to the instance would be through RDP.

Accessing the instance

From the remote machine, navigate to Start → Programs → Accessories → Remote Desktop Connection.
Specify the public ip address that the instance gets and click Connect.
The desktop of the windows instance should be accessible after providing the credentials.

CREDITS: This post has its place, because of Sam’s contribution, to which I have added my pieces.

Filed under: Cloud Computing, euca-bundle-images, Eucalyptus, Eucalyptus Bundling, UEC

Read the original blog entry...

More Stories By Kiran Murari

Kiran Murari works at CSS Corp. Earlier, he was into the domain of Embedded Networking and has worked on developing software for ARM and MIPS based routers, porting Linux kernel and Linux applications to various hardware platforms like Intel IXP4xx, Xscale and OMAP3. As a part of developing software for routers, he was involved in developing the firewall and IDS/IPS modules. His current interests include Virtualization, Cloud Computing and Embedded devices.