Difference between revisions of "Device not visible in Xen domainU guest when using xm block-attach command to add a disk or CD-ROM/DVD drive"

(New page: Xen provides the flexibility to add block devices to a running domainU guest system using the ''xm block-attach'' command. This is especially useful for giving the domainU system access to...)
 
 
(2 intermediate revisions by one other user not shown)
Line 11: Line 11:
 
There are a number of rules that must be following before a block device can be attached. Firstly, the device must be mounted and visible on the domain0 system. Secondly, the device must not already be attached in ''write'' mode to any other domainU systems. Finally, 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 drives).
 
There are a number of rules that must be following before a block device can be attached. Firstly, the device must be mounted and visible on the domain0 system. Secondly, the device must not already be attached in ''write'' mode to any other domainU systems. Finally, 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 drives).
  
Assuming the above criteria have been met and you are not seeing the attached block device in the domainU system it is possible that you are using the wrong device name for what is known as the ''front end'' device. the ''front end'' device is the device name by which the block device will be accessed on the domainU guest. In fact the only way that the device will be visible is if the device name begins ''xd''. If you have used a device names such as dev/sdb1, /dev/hda2 or /dev/sr0 then the device will not be visible in the domainU.  
+
Assuming the above criteria have been met and you are not seeing the attached block device in the domainU system it is possible that you are using the wrong device name for what is known as the ''front end'' device. The ''front end'' device is the device name by which the block device will be accessed on the domainU guest. In fact the only way that the device will be visible is if the device name begins ''xvd''. If you have used a device names such as dev/sdb1, /dev/hda2 or /dev/sr0 then the device will not be visible in the domainU.  
  
 
For example the following will NOT work:
 
For example the following will NOT work:
Line 25: Line 25:
 
</pre>
 
</pre>
  
Once the attachment has been initiated the device should now be visible in the /dev directory of the domainU guest and can be mounted at a suitiable mount point:
+
Once the attachment has been initiated the device should now be visible in the /dev directory of the domainU guest and can be mounted at a suitable mount point:
  
 
<pre>
 
<pre>
 
mount -t ext3 /dev/xvda2 /mnt
 
mount -t ext3 /dev/xvda2 /mnt
 
</pre>
 
</pre>

Latest revision as of 21:03, 28 March 2009

Xen provides the flexibility to add block devices to a running domainU guest system using the xm block-attach command. This is especially useful for giving the domainU system access to disk partitions and CDROM/DVD drives which are physically attached to the host system.

A common problem encountered by Xen administrators is that a device attached to the domainU guest using xm attach on the host system fails to be appear in domainU guest.

The format for attaching block devices using xm block-attach is as follows:

xm block-attach <domain id> <device on host> <device on domainU> <mode>

There are a number of rules that must be following before a block device can be attached. Firstly, the device must be mounted and visible on the domain0 system. Secondly, the device must not already be attached in write mode to any other domainU systems. Finally, 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 drives).

Assuming the above criteria have been met and you are not seeing the attached block device in the domainU system it is possible that you are using the wrong device name for what is known as the front end device. The front end device is the device name by which the block device will be accessed on the domainU guest. In fact the only way that the device will be visible is if the device name begins xvd. If you have used a device names such as dev/sdb1, /dev/hda2 or /dev/sr0 then the device will not be visible in the domainU.

For example the following will NOT work:

xm block-attach 2 phy:/dev/sdc2 /dev/sdc2 w

Instead an xvd device name must be used. For example:

xm block-attach 2 phy:/dev/sdc2 /dev/xvda w

Once the attachment has been initiated the device should now be visible in the /dev directory of the domainU guest and can be mounted at a suitable mount point:

mount -t ext3 /dev/xvda2 /mnt