Jump to contentJump to page navigation: previous page [access key p]/next page [access key n]
Applies to SUSE Linux Enterprise Server 11 SP4

7 Block Devices in Xen

7.1 Mapping Physical Storage to Virtual Disks

Virtual disks can be based on the following types of physical devices and files. Each type includes an example statement.

  • A physical disk device, such as a DVD, that is accessible as a device to the host.

    phy:/dev/cdrom
  • A file that contains a disk image accessible from the file system of the host. The disk formats raw, qcow and qcow2 have read and write support. The vmdk, vpc, vhd/vhdx are only supported in read-only mode. Also, the http, https, ftp, ftps and tftp protocols are supported for read-only access to images.

    file:/mnt/disks/sles10sp1.iso

    tap:aio:/mnt/disks/sles10sp1.iso specifies a raw disk that might be taken from a different virtualization platform.

    tap:qcow:/mnt/disks/sles10sp1.iso.qcow
    tap:vmdk:/mnt/disks/sles10sp1.iso.vmdk
  • A remote storage device specified using the Internet SCSI (iSCSI) protocol.

    iscsi:iqn.2001-04.com.acme@0ac47ee2-216e-452a-a341-a12624cd0225
  • A remote storage device specified using a Fibre Channel (NPIV) protocol.

    npiv:210400e08b80c40f

To specify a mapping between physical storage and the virtual disk, you might need to edit the virtual machine’s disk information. Follow the instructions in Section 5.3, “Configuring a Virtual Machine by Modifying its Xend Settings”, to change the respective device entry to the desired setting.

Example 7.1: Example: Virtual Machine Output from Xend
(vbd
  (dev xvda:disk)
  (uname file:/var/lib/xen/images/sles11/disk0)
  (mode w)
  (type disk)
  (backend 0)
)
Table 7.1: Available uname Settings

Protocol

Description

Example

phy:

Block devices, such as a physical disk, in domain 0

phy:/dev/sdc

file:

Raw disk images accessed by using loopback

file:/path/file

nbd:

Raw disk images accessed by using NBD

ndb: ip_port

tap:aio:

Raw disk images accessed by using blktap. Similar to loopback but without using loop devices.

tap:aio:/path/file

tap:cdrom

CD reader block devices

tap:cdrom:/dev/sr0

tap:vmdk:

VMware disk images accessed by using blktap

tap:vmdk:/path/file

tap:qcow:

QEMU disk images accessed by using blktap

tap:qcow:/path/file

iscsi:

iSCSI targets using connections initiated from domain 0

iscsi:IQN,LUN

npiv:

Fibre Channel connections initiated from domain 0

npiv:NPIV,LUN

7.2 File-Backed Virtual Disks and Loopback Devices

When a virtual machine is running, each of its file-backed virtual disks consumes a loopback device on the host. By default, the host allows up to 64 loopback devices to be consumed.

To simultaneously run more file-backed virtual disks on a host, you can increase the number of available loopback devices by adding the following option to the host’s /etc/modprobe.conf.local file.

options loop max_loop=x

where x is the maximum number of loopback devices to create.

Changes take effect after the module is reloaded.

Tip
Tip

Enter rmmod loop and modprobe loop to unload and reload the module. In case rmmod does not work, unmount all existing loop devices or reboot the computer.

7.3 Resizing Block Devices

While it is always possible to add new block devices to a VM Guest system, it is sometimes more desirable to increase the size of an existing block device. In case such a system modification is already planned during deployment of the VM Guest, some basic considerations should be done:

  • Use a block device that may be increased in size. LVM devices and file system images are commonly used.

  • Do not partition the device inside the VM Guest, but use the main device directly to apply the file system. For example, use /dev/xvdb directly instead of adding partitions to /dev/xvdb.

  • Make sure that the file system to be used can be resized. Sometimes, for example with ext3, some features must be switched off to be able to resize the file system. A file system that can be resized online and mounted is XFS. Use the command xfs_growfs to resize that file system after the underlying block device has been increased in size. For more information about XFS, see man 8 xfs_growfs.

When resizing a LVM device that is assigned to a VM Guest, the new size is automatically known to the VM Guest. No further action is needed to inform the VM Guest about the new size of the block device.

When using file system images, a loop device is used to attach the image file to the guest. For more information about resizing that image and refreshing the size information for the VM Guest, see Section 10.2, “Sparse Image Files and Disk Space”.

Print this page