CD Rom Support in Xen

From Xen


CDROM Support under Xen Guests


This page will give some information about CDROM support under Xen guests.

PV Guest

Currently, there's no paravirtual CDROM driver available. So in PV guest, you can only add a iso image as a disk and cannot change this disk at runtime. But as a workaround, you can detach it and re-attach another iso as the same frontend.

HVM Guest

Adding CDROM to Guest

To add a physical CDROM drive or iso file as CDROM, you need to append ":cdrom" suffix to the target device name. Eg.

disk = ['phy:/dev/sr0,hdc:cdrom,r']
disk = ['phy:/dev/hdc,hdc:cdrom,r']
disk = ['file:/test.iso,hdc:cdrom,r']
disk = ['phy:/dev/null,hdc:cdrom,r']
disk = [',hdc:cdrom,r']


Change CDROM for a running guest

If you attached a physical CDROM drive, the CDROM media in the guest will change automatically when you change it physically.

If it doesn't change, you can try a few things:

Reinsert cdrom from guest

Typically if the CDROM drive is not automatically detected by the guest it is due to the fact that eject / insert of the device is not propagated to the guest, this can be fixed, but to avoid dealing with that you can also just try to use the following commands from the guest:

To eject from the guest:

# eject

To detect the insertion of a new CD:

# eject -t

Playing with these two should in most cases resolve messaging issues.

Reinsert cdrom to guest from dom0

Execute the following command in Dom0:

# xl block-attach [DomID] "phy:/dev/hdc,hdc:cdrom,r"
or: 
# xl block-attach [DomID] "file:/test.iso,hdc:cdrom,r"
if you want to bind an iso to a CDROM.

If you are using the SDL viewer, Inside the VM press the following key combination to get into the monitor:

Ctrl-Alt-2

And then use the following command to eject the CDROM:

eject hdc [return]

Now you should be able to eject the cd manually, and put in a different CD. Then type the following command to change CDROM for the guest:

change hdb /dev/hdc [return]

To get back to the VM gui, press:

Ctrl-Alt-1

The new disk should be ready for mounting.

Booting from CDROM

To boot from CDROM, add config parameter "boot=c" to the vm configure file.

Troubleshooting

  • Under certain circumstance, using /dev/cdrom, which is a symbol link to the actual device, doesn't work.