vdev virtio-blk

Provide the standard VIRTIO interface for block devices

Synopsis:

vdev virtio-blk options

Options:

delayed seconds|forever
If specified, delay opening the device in the host until it is first referenced by the guest.
If the device isn't found in the host, continue trying for the number of seconds specified by seconds before timing out (e.g., delayed 5). If seconds is set to 0 (i.e., delayed 0), try only once to find the device on the host. If the argument is set to “forever” (i.e., delayed forever), never time out, just keep trying to find the device on the host.
dio enable|disable
Configure the use of Direct I/O when processing the guest's requests. The enable setting activates it for both read and write requests. The default setting is disable, meaning Direct I/O is not used by default.

If a Direct I/O access fails at any point (either because it's not supported by the back-end driver or for any other reason), the device will permanently switch back to using _IO_READ and _IO_WRITE messages.

hostdev [<]host_filename
Provide the name of the host file to use for the contents of the device.
A “<” symbol in front of host_filename indicates that device contents will be enforced as read-only (e.g., hostdev </dev/hd0 will make /dev/hd0 read-only to the guest). The default of no < means read/write access.
intr intr
Signal intr for device interrupts. Not required when the vdev appears as a PCI device.
legacy
Provide the VIRTIO legacy interface (0.9.5) rather than the 1.0 or later standard versions.
loc addr
Set the base address of the device registers to addr. Not required if the vdev appears as a PCI device.
threads number
Set the number of threads for processing requests. This number must be at most 32, and will be truncated to the maximum that the back-end device actually supports, if the device has a thread limit smaller than 32.
Note:

For better performance, we recommend using a number of threads that is based on the configuration of your hypervisor host system. If the system is single-core, use just one thread. If it's quad-core, for optimal performance, use between two and four threads.

For multi-threading to work properly, the guest must support multi-threaded operation through its VIRTIO driver, and the back-end device (i.e., the vdev) must also support multi-threaded operation. To complete a multi-threaded request, if a hardware device (e.g., eMMC) is controlled by a back-end device (in the hypervisor host domain) then the hardware also must support multi-threading and this must be enabled by the device. If any part of this chain is not multi-threaded then single-threading may occur and less efficiency will be gained.

For a list of options available to all vdevs, see Common vdev options at the beginning of this chapter.

Description:

ARM and x86. The virtio-blk vdev provides an interface for block devices. Normally this device appears as a PCI device, but if you specify the loc and intr options, the guest will see it as a memory-mapped I/O device at the specified location.

For virtio-blk, packed virtqueues are enabled if the guest supports them.

CAUTION:
Under no circumstances should a block device containing a filesystem be shared between two entities (host or guests), even if one side is read-only. If such sharing is allowed, the two entities cannot synchronize and are unaware of each other's caches, resulting in unpredictable behavior.