LinuxCommandLibrary

virsh-domblklist

List block devices attached to a domain

TLDR

List the target name and source path of the block devices

$ virsh domblklist --domain [vm_name]
copy

List the disk type and device value as well as the target name and source path
$ virsh domblklist --domain [vm_name] --details
copy

SYNOPSIS

virsh domblklist domain [--details] [--paths] [--source] [--device] [--target] [--type type] [--config] [--live] [--persistent] [--inactive] [--all] [--driver] [--address] [--io] [--bytes] [--physical]

PARAMETERS

domain
    The name, UUID, or ID of the virtual machine to query.

--details
    Show detailed information for each block device, including bus type and device type.

--paths
    Display the source paths of the block devices on the host.

--source
    Only display the host-side source paths of the devices.

--device
    Only display the target device names as seen within the guest.

--target
    An alias for --device, showing target device names.

--type type
    Filter devices by a specific type (e.g., 'disk', 'cdrom', 'floppy').

--config
    Show devices from the domain's persistent XML configuration.

--live
    Show devices currently attached to the running domain instance.

--persistent
    Similar to --config, shows devices from the persistent configuration.

--inactive
    Show devices that are part of the inactive (pending) configuration.

--all
    Show all devices, combining live and configured devices.

--driver
    Display the storage driver used for the device (e.g., 'qcow2', 'raw').

--address
    Display the PCI or controller address of the device.

--io
    Display I/O statistics for the device (requires --live).

--bytes
    Display byte statistics for the device (requires --live).

--physical
    Show the physical source details of the underlying storage, where applicable.

DESCRIPTION

The virsh domblklist command provides a comprehensive overview of the block devices associated with a specified virtual machine (domain) managed by libvirt. It's a crucial tool for administrators to inspect the storage configuration of their virtualized environments. This command can enumerate virtual disks, CD-ROM drives, and other storage-related devices. Depending on the options used, it can display details such as the host-side source path (e.g., a file path or a LVM volume), the target device name within the guest operating system, the device type, and various operational flags like whether the device is currently active or part of the persistent configuration. It's particularly useful for verifying storage mappings, troubleshooting disk-related issues, or gathering information before performing storage-related operations like resizing or migrating disks.

CAVEATS

Some options like --io or --bytes only provide data for live domains and may require specific driver support or a running guest agent to be accurate. The output format can vary slightly between different libvirt versions. Accurate information requires appropriate permissions to query domain details.

<B>OUTPUT INTERPRETATION</B>

The default output typically shows the 'Target' (the device name inside the guest, e.g., "vda", "sdb") and 'Source' (the path to the disk image or device on the host, e.g., "/var/lib/libvirt/images/myvm.qcow2", "/dev/vg/lv_data"). The --details option adds columns like "Bus" (e.g., virtio, sata, ide) and "Type" (e.g., disk, cdrom).

<B>USAGE SCENARIOS</B>

Commonly used to quickly verify if a new disk has been correctly attached to a VM, to identify the host path for a guest's disk for backup or inspection purposes, or to troubleshoot issues related to disk visibility within the guest.

HISTORY

The virsh domblklist command is an integral part of the libvirt project, which began development in 2005. As libvirt evolved to support a wider range of hypervisors and advanced virtualization features, domblklist, along with other dom* commands, matured to provide increasingly detailed and granular control over virtual machine configurations. Its development closely parallels the general progress of libvirt itself, incorporating new options and capabilities as underlying virtualization technologies (like QEMU/KVM) added more sophisticated block device management features.

SEE ALSO

virsh(1), virsh domblkinfo(1), virsh domblkstat(1), virsh domblkresize(1), virsh domattachdevice(1), virsh domdetachdevice(1), lsblk(8)

Copied to clipboard