KVM - Online Disk Resize

This HOWTO assumes a KVM guest called 'vm' backed by an LVM volume called 'vm-data'.

On Hypervisor

# lvs
  vm-data      VG -wi-ao--  100.00g
# lvresize -L 200G /dev/VG/vm-data
  Extending logical volume vm-data to 200.00 GiB
  Logical volume vm-data successfully resized
# lvs
  vm-data      VG -wi-ao--  200.00g
# virsh blockresize --path /dev/VG/vm-data --size 200G vm
Block device '/dev/VG/vm-data' is resized

Depending on how the disk is used inside the guest (DRBD disk, partitioned block device, LVM physical volume) continue with one of the three alternatives

On Guest - When Resizing DRBD disk

If the resized disk is a DRBD resource called 'data' and has ext4 filesystem on it

# drbdadm resize data
# resize2fs /dev/drbd0

On Guest - When Resizing Partitioned Disk

If the resized disk is partitioned block device /dev/vda and we want to resize the last partition /dev/vda3 with ext4 on it

# parted /dev/vda
(parted) print free
Number  Start   End     Size    Type     File system     Flags
 1      32.3kB  4295MB  4295MB  primary  ext4            boot
 2      4295MB  8590MB  4295MB  primary  linux-swap(v1)
 3      8590MB   107GB    98GB  primary  ext4
         107GB   215GB   107GB  Free Space
(parted) resizepart 3
End [107GB]? 215GB
(parted) quit
# resize2fs /dev/vda3

On Guest - When Resizing LVM Physical Volume

If the resized disk has a single partition used as an LVM physical volume.

First we use the parted command from the above 'When Resizing Partitioned Disk' steps to resize /dev/vda1, then

# pvresize /dev/vda1
  Physical volume "/dev/vda1" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized
# vgs
# lvresize -L 256g /dev/VG/DATA
  Size of logical volume VG/DATA changed from 238.00 GiB (60927 extents) to 256.00 GiB (65536 extents).
  Logical volume DATA successfully resized
# resize2fs /dev/VG/DATA