Adding CD/DVD drives to a running Xen domainU guest
at Saturday, August 02, 2008
Xen provides great flexibility in terms of dynamically adding block devices such as disk drives and CDROM/DVD drives to running domainU guest systems.
This is achieved using the xm block-attach command, the syntax for which is as follows:
Next we need to identify the domainU to which we wish to attach the device. A list of running running guests can be obtained using xm list:
With this information we can now attach our DVD device to the domainU guest:
To detach the device first unmount it from the domainU system:
Source: http://www.virtuatopia.com/index.php/How_to_add_a_CDROM_or_DVD_drive_to_a_running_Xen_domainU_guest
This is achieved using the xm block-attach command, the syntax for which is as follows:
xm block-attach <Domain Id> <Backend Device> <Frontend Device> <Mode>where:
- <Domain Id> is the id of the domainU to which the device is to be attached (this can be obtained by running xm list)
- <Backend Device> represents the device as it is represented on the domain0 host system prefixed with the type. For example:
- <Frontend Device> is the device name for access on the domainU guest system. This name must be prefixed with xvd otherwise the device will not be visible to the domainU guest. For example:
- <Mode> is the read/write mode under which the device is to be attached. Options are r for read-only, w for read/write and w! for read/write with sharing.
/dev/sr0 on /media/LXFDVD100A type iso9660 (ro,nosuid,nodev,uhelper=hal,uid=500)
Next we need to identify the domainU to which we wish to attach the device. A list of running running guests can be obtained using xm list:
xm list Name ID Mem VCPUs State Time(s) Domain-0 0 875 1 r----- 574.0 XenGuest1 3 128 1 -b---- 96.4This shows only one guest running which is XenGuest1 with an ID of 3.
With this information we can now attach our DVD device to the domainU guest:
xm block-attach 3 phy:/dev/sr0 /dev/xvda2 rOnce the device is attached log into the domainU system and check the device is now visible:
brw-r----- 1 root disk 202, 2 2008-05-02 15:12 /dev/xvda2Assuming the device is visible all that remain is to mount it:
mount /dev/xvda2 /mnt mount: block device /dev/xvda2 is write-protected, mounting read-onlyThe device is now mounted and accessible.
To detach the device first unmount it from the domainU system:
umount /mntFinally, detach the device from the domain0 host using xm block-detach combined with the domainU ID and the frontend device name (in this case /dev/xvda2):
xm block-detach 3 /dev/xvda2
Source: http://www.virtuatopia.com/index.php/How_to_add_a_CDROM_or_DVD_drive_to_a_running_Xen_domainU_guest




