Scanning for new disks attached using virtio

block-devicekvm-virtualizationvirtio

I can successfully attach disks to a running KVM instance using virsh attach-disk

virsh attach-disk node-1 /dev/vg_lunsr/lun1  vdb
Disk attached successfully

…but these new devices aren't seen by the guest without a reboot, which almost defeats the purpose of dynamic attachment. If these were SCSI devices I would use e.g. /sys/class/scsi_host/host0/scan to request the SCSI drivers to scan for new devices. Is there an equivalent capability for the virtio block driver?

Best Answer

Yes, it mostly depends on what distro is running inside the guest. On Debian/Ubuntu, you certainly want to load this kernel module:

modprobe acpiphp

and then try to hot plug your devices. It will appear without guest reboot. You can find more information about hot plugging in libvirt here