Changes

Jump to: navigation, search
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...
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:

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

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:

<pre>
phy:/dev/sr0
</pre>

* ''<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:

<pre>
/dev/xvda2
</pre>

* ''<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.

Navigation menu