In our example, hosts are named host.example.com_ip_address
but you might well be using a different convention.
Shut down the host
SSH the hypervisor
Check all running VMs
virsh list
Check the running VM’s block list and identify the disk name (name of the file of the VM)
virsh domblklist host.example.com_ip_address Target Source ------------------------------------------------ vda /var/lib/libvirt/images/host.example.com.qcow2 hda -
Stop the running VM
virsh shutdown host.example.com_ip_address Domain host.example.com_ip_address is being shutdown
Wait a while. virsh list
should tell you once it’s finally shutdown. It goes from running to in shutdown
and then it’s off the list.
Make the host hypervisor disk bigger:
qemu-img resize host.example.com.qcow2 +50G Image resized.
Start the host again
virsh start host.example.com_ip_address Domain host.example.com_ip_address started
Log into the VM (SSH to the VM)
Examine the disk layout. There are too many commands to do this, and here is a subset. Examining the disk is just so that you can orientate yourself and entirely optional.
fdisk -l / lsblk / pvdisplay / pvs / vgs / vgdisplay
Run all the disk resizing commands
- parted /dev/vda
- resizepart
- 100%
- pvresize /dev/vda2
- You should see `1 physical volume(s) resized or updated`
- xfs_growfs /
- lvextend -r -l +100%FREE /dev/mapper/cl-root
- You should see `Size of logical volume cl/root changed from 245.02 GiB (62726 extents) to 295.02 GiB (75526 extents).`