Categories
Uncategorized

Online resizing of LVM Virtio disk with an Ubuntu VM

To resize an Ubuntu VM running with QEMU+KVM+Libvirt, with a raw disk using LVM, you can follow these simple steps:

  • lvextend -L +20G /dev/lvmpool/web01
    • Use lvdisplay to check the new LV size
  • virsh blockresize web01 vda 90G # where 90G is the new size of the LVM
    • You should get a success message such as “Block device ‘vda’ is resized”
  • Now in the VM, you can use these steps:
    • growpart /dev/vda 2 # to take up all unallocated space
    • verify with lsblk if you see the new disk size
    • resize the disk: resize2fs /dev/vda2