Adding Disk, CDROM and DVD Devices to a Running Xen domainU Guest System

From Virtuatopia
Revision as of 19:36, 2 May 2008 by Admin (Talk | contribs) (New page: Most Xen domainU guests are configured with access to a number of devices, typically for the root filesystem and swap space. it is not uncommon, however, to need to provide an executing do...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Most Xen domainU guests are configured with access to a number of devices, typically for the root filesystem and swap space. it is not uncommon, however, to need to provide an executing domainU system with temporary access to block devices such as disks and CD/DVD drives.

Fortunately Xen provides considerable flexibility in terms of adding devices to a running domainU guest system and subsequently detaching them when they are no longer required. This chapter will cover the basics of this topic area.

Requirements for Xen domainU Block Device Attachment

Before a block device can be attached to running domainU guest system there are a number of rules which must be observed. These important rules are as follows:

  • The device to be attached must be mounted on the domain0 host system.
  • The device must not already be attached in write mode to any other domainU systems.
  • The domainU system must possess the appropriate drivers to read the filesystem located on the device. This is not usually an issue for Linux filesystems and CD/DVD devices but may be an issue for more rare and exotic filesystems.
  • The device name by which the domainU system will access the device must begin with xdv (for example /dev/xvda1).

An Overview of xm block-attach

Devices are attached to domainU guest system using the xm block-attach command the syntax for which is as follows:

xm block-attach <Domain Id> <Backend Device> <Frontend Device> <Mode>

Each of the commandline arguments warrants a brief explanation:

  • <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:
phy:/dev/sr0
  • <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:
/dev/xvda2
  • <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.