Libvirt does not see updated LVM volume

r.sendecky asked:

All VMs run off an LVM pool.

I resized one of the LVM volumes to increase VMs drive copacity.
Resized it with lvextend as usual.
Everything is successful and lvs shows the new size.

Libvirt does not see the new size though. I try refreshing – no luck.
It still shows old capacity.

Running virsh vol-info on the volume shows the old size in capacity entry and the new size in allocation entry. Why is this so? It never used to be like this. Increasing an LVM volume would propagate and be visible after a refresh.

Now, the only way to get this new size to the VM is to reboot, which is out of the question. How can I make the new size visible?

EDIT

OS: Arch
Libvirt: 1.3.0
Qemu: 2.4.1

Restarting libvirt service does not help either. The volume still shows up with the old size in libvirt.

lvs

...      
  sswus00-vd0     vga  -wi-a----- 200.00g
...

virsh vol-info --pool pool sswus00-vd0

Name:           sswus00-vd0
Type:           block
Capacity:       100.00 GiB
Allocation:     200.00 GiB

So capacity is still at the old size and that is what VM gets.

EDIT2

This is really strange.

lsblk shows the old disk size for this lvm volume – 100G
But lvs shows the new size – 200g

The back-end for the logical volume group is iSCSI.
So I thought maybe rescanning scsi bus would help.

Neither echo "- - -" > echo "- - -" > /sys/devices/platform/host2/scsi_host/host2/scan

or iscsiadm -m node -R

make any difference

Any ideas? How would I make kernel aware of the new size? And most important why it is doing this?

My answer:


You can send a qemu monitor command to the VM’s qemu process to cause it to recognize the new size of the block device. For example:

virsh qemu-monitor-command vmname --hmp "block_resize drive/virtio-disk0 200G"

Note that drive/virtio-disk0 refers to qemu’s idea of the drive, which will vary depending on the driver in use (e.g. virtio or virtio-scsi) and which virtual drive it is in order (the 0 will change to a 1, 2, etc.). For a SCSI drive, you would have something like drive-scsi0-0-0-0 where the numbers refer to the virtual controller, bus, target and LUN as defined in the libvirt XML.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.