问题原文
原帖链接 · MegaBrutal · CC BY-SA 4.0
I have a virtio disk mounted to a KVM guest, backed by an LVM logical volume. I increased the size of the logical volume with lvresize on the KVM host machine.
Then I had to issue virsh pool-refresh to make the KVM host aware of the volume size change. Now if I check the volume in virt-manager, I see the correct disk size. But the guest OS still sees the disk by its old size no matter what.
How can I force the Linux kernel to rescan virtio disks without rebooting the guest?
The other solutions I found were not specific to virtio and they didn't work.
Like echo "- - -" > /sys/class/scsi_host/host0/scan should work for SCSI disks, but not virtio. Another tip, echo 1 > /sys/block/vda/device/rescan doesn't work because the rescan file doesn't exist.
So do you know about any virtio specific tip to have my virtio disk rescanned?
已采纳解答
原帖链接 · John Mahowald · CC BY-SA 4.0
In addition to resizing the LV on the host, tell the running guest about it: virsh blockresize <domain> vda
As a paravirtualized driver, virtio does not pretend to be SCSI anymore, rescan hints will not work. As soon as the guest is aware if it, the volume will be larger.
While not useful in this case, a more complete SCSI scan script for Linux is rescan-scsi-bus.sh from the sg3_utils package.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
