Your browser may have trouble rendering this page. See supported browsers for more information.

|<<>>|205 of 273 Show listMobile Mode

Eject/Change a CD from Windows inside a XEN-VM using VNC

Published by marco on

This article was originally published on the Encodo Blogs. Browse on over to see more!


At Encodo, we currently run Debian Etch on our servers, with a Xen hypervisor managing a bunch of individual virtual machines (VMs). Most of the VMs also run Debian Etch, but one of them runs Windows Server 2003 instead. We use this machine for testing integration with Microsoft technologies like Sharepoint, Exchange and so on. Recently, we had to re-install the Exchange instance on that server and were faced with the problem of having to change the CD without rebooting the VM. Luckily, we found the article, Xen 3.0.3 change cdrom with windows 2003, which cryptically describes how to do this. The instructions describe pressing ctrl+alt+1, but where?

The trick is to realize that they are assuming three things:

  1. You have configured the VM to provide a VNC port
  2. You have attached to said port with a VNC viewer
  3. You realize that you can’t press these keys directly, but must select them from the viewer’s system menu (as shown below).

Before you do anything, verify that you have made the physical CD/DVD available to the machine, by specifying something like the following in the XEN configuration file for the VM:

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

The first disk (disk1.img) is a disk image for the system itself; the second disk (hdc:cdrom) is the physical CD/DVD. Until you see the CD inside the VM, you don’t have to even worry about trying to eject it.

You also need to make sure the VNC port is available, again with a line in the configuration:

vnc=1

If you make any changes to the configuration, you’ll need to restart the VM before you see the effects. Use the additional configuration option called vncpasswd to lock down the VNC port.

Once you can see the CD within the VM and you can open a connection with the VNC viewer, you’re ready to actually follow the instructions in the post linked above:

  1. type ctrl-alt-2
  2. type help <return>
  3. type eject hdb <return>
  4. Change the CD manually (at the server itself)
  5. type change hdb /dev/cdrom[1]

At this point, you might think you’re done, but the first step is a stumbling block as you don’t actually type ctrl and alt; instead, you select them from the system menu, as illustrated below:

That’s it; you should see the new CD in the VM and you can continue with your installation.


[1] Where /dev/cdrom corresponds to the CD/DVD drive in question.