我在 KVM 主机上有以下设置:
virsh # pool-info --pool pool
Name: pool
UUID: bb13c37c-47fe-c4a9-78a4-9c8abc7524fe
State: running
Persistent: yes
Autostart: yes
Capacity: 1.64 TiB
Allocation: 712.00 GiB
Available: 963.12 GiB
virsh # vol-list --details --pool pool
Name Path Type Capacity Allocation
---------------------------------------------------------------------------------
volume1 /dev/pool/volume1 block 192.00 GiB 192.00 GiB
volume2 /dev/pool/volume2 block 192.00 GiB 192.00 GiB
volume3 /dev/pool/volume3 block 192.00 GiB 192.00 GiB
volume4 /dev/pool/volume4 block 136.00 GiB 136.00 GiB
virsh # vol-info --pool pool volume3
Name: volume3
Type: block
Capacity: 192.00 GiB
Allocation: 192.00 GiB
我在卷 3 中运行虚拟机,磁盘几乎已满。在扩展虚拟机上的磁盘之前,我想我必须扩展底层卷。
但是当我尝试将卷 3 扩展到 500GB 时出现以下错误:
virsh # vol-resize volume3 --capacity 500G --pool pool --allocate
error: Failed to change size of volume 'volume3' to 500G
error: invalid argument: storageVolumeResize: unsupported flags (0x1)
当我尝试在不分配空间的情况下扩展卷时,出现不同的错误:
virsh vol-resize volume3 --capacity 500G --pool pool
error: Failed to change size of volume 'volume3' to 500G
error: this function is not supported by the connection driver: storage pool does not support changing of volume capacity
有任何想法吗?
编辑:我也尝试了 blockresize,没有变化:
virsh # blockresize volume3 /dev/pool/volume3 734003200
error: Failed to resize block device '/dev/pool/volume3'
error: internal error unable to execute QEMU command 'block_resize': An undefined error has occurred
答案1
首先,您需要使用lvresize
命令调整块设备的大小,然后您需要告诉 libvirt 新的大小。
你应该可以这样做:
$ lvresize -L 500G /dev/pool/volume3
$ virsh blockresize volumes3 --path /dev/pool/volume3 --size 500G