Rescan PCI for new virtio devices

Rescan PCI for new virtio devices

I want to extend a running KVM Linux guest system with a physical hard drive. I’ve connected the new disk via

virsh attach-disk my_vm /dev/sdf vdc

to connect sdf to vdc, but inside the guest, nothing happens.

The solution is simple: attaching a new disk requires a new virtio block controller which is a PCI device. The trick is to rescan the PCI bus system to detect the new controller:

echo 1 > /sys/bus/pci/rescan

Now lspci shows the new controller and dmesg shows the new vdc block device.

00:08.0 SCSI storage controller: Red Hat, Inc Virtio block device

Update:

Simply load the both modules

acpiphp pci_hotplug

then you don’t need to rescan the PCI bus.

Daniel Vogelbacher's Picture

About Daniel Vogelbacher

Hi, I'm Daniel, a software developer, Linux administrator and landscape photographer.

Germany https://chaospixel.com