-> Inside the guest
-------------
[root@localhost ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/fedora-root ext4 5.4G 5.4G 0 100% /
devtmpfs devtmpfs 4.7G 0 4.7G 0% /dev
tmpfs tmpfs 4.7G 0 4.7G 0% /dev/shm
tmpfs tmpfs 4.7G 392K 4.7G 1% /run
tmpfs tmpfs 4.7G 0 4.7G 0% /sys/fs/cgroup
tmpfs tmpfs 4.7G 472K 4.7G 1% /tmp
/dev/vda1 ext4 477M 87M 365M 20% /boot
/dev/loop0 ext4 4.6G 10M 4.4G 1% /srv/node/device1
/dev/loop1 ext4 4.6G 10M 4.4G 1% /srv/node/device2
/dev/loop2 ext4 4.6G 10M 4.4G 1% /srv/node/device3
/dev/loop3 ext4 4.6G 10M 4.4G 1% /srv/node/device4
/dev/vdb ext4 17G 44M 16G 1% /mnt/newdisk
-------------
-> Print the XML to get the disk source:
-------------
$ virsh dumpxml f19-test | grep -i source
-------------
-> Get the size of the qcow2 image
-------------
$ ls -lash /var/lib/libvirt/images/f19-test.qcow2
5.7G -rw-r--r--. 1 root root 11G Apr 10 10:26 /var/lib/libvirt/images/f19-test.qcow2
-------------
$ df -hT
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 12G 0 12G 0% /dev
tmpfs tmpfs 12G 0 12G 0% /dev/shm
tmpfs tmpfs 12G 317M 11G 3% /run
tmpfs tmpfs 12G 0 12G 0% /sys/fs/cgroup
/dev/mapper/fedora_dhcp207--228-root ext4 63G 25G 35G 42% /
tmpfs tmpfs 12G 1.9M 12G 1% /tmp
/dev/sda1 ext4 772M 94M 638M 13% /boot
-------------
-> List the filesystems inside the disk image:
-------------
$ virt-filesystems --long -h -a /var/lib/libvirt/images/f19-test.qcow2
Name Type VFS Label Size Parent
/dev/sda1 filesystem ext4 - 500M -
/dev/fedora/root filesystem ext4 - 5.6G -
-------------
$ virt-filesystems --long --all -h -a /var/lib/libvirt/images/f19-test.qcow2
Name Type VFS Label MBR Size Parent
/dev/sda1 filesystem ext4 - - 500M -
/dev/fedora/root filesystem ext4 - - 5.6G -
/dev/fedora/swap filesystem swap - - 3.9G -
/dev/fedora/root lv - - - 5.6G /dev/fedora
/dev/fedora/swap lv - - - 3.9G /dev/fedora
/dev/fedora vg - - - 9.5G /dev/sda2
/dev/sda2 pv - - - 9.5G -
/dev/sda1 partition - - 83 500M /dev/sda
/dev/sda2 partition - - 8e 9.5G /dev/sda
/dev/sda device - - - 10G -
-------------
-> Convert the qcow2 image to raw, & list the file system info again, inside the
guest.
-------------
$ qemu-img convert -f qcow2 -O raw /var/lib/libvirt/images/f19-test.qcow2 /var/lib/libvirt/images/f19-test.raw
-------------
$ virt-filesystems --long --all -h -a /var/lib/libvirt/images/f19-test.raw
Name Type VFS Label MBR Size Parent
/dev/sda1 filesystem ext4 - - 500M -
/dev/fedora/root filesystem ext4 - - 5.6G -
/dev/fedora/swap filesystem swap - - 3.9G -
/dev/fedora/root lv - - - 5.6G /dev/fedora
/dev/fedora/swap lv - - - 3.9G /dev/fedora
/dev/fedora vg - - - 9.5G /dev/sda2
/dev/sda2 pv - - - 9.5G -
/dev/sda1 partition - - 83 500M /dev/sda
/dev/sda2 partition - - 8e 9.5G /dev/sda
/dev/sda device - - - 10G -
-------------
-> Extend the size the file using `truncate`
-------------
$ truncate -r f19-test.raw f19-test.raw.new
-------------
$ truncate -s +15G f19-test.raw.new
-------------
$ virt-filesystems --partitions --long -h -a f19-test.raw
Name Type MBR Size Parent
/dev/sda1 partition 83 500M /dev/sda
/dev/sda2 partition 8e 9.5G /dev/sda
-------------
-> Run the virt-resize command:
-------------
$ virt-resize --expand /dev/sda2 --lv-expand /dev/fedora/root f19-test.raw f19-test.raw.new
Examining f19-test.raw ...
**********
Summary of changes:
/dev/sda1: This partition will be left alone.
/dev/sda2: This partition will be resized from 9.5G to 24.5G. The LVM
PV on /dev/sda2 will be expanded using the 'pvresize' method.
/dev/fedora/root: This logical volume will be expanded to maximum size.
The filesystem ext4 on /dev/fedora/root will be expanded using the
'resize2fs' method.
**********
Setting up initial partition table on f19-test.raw.new ...
Copying /dev/sda1 ...
100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00
Copying /dev/sda2 ...
100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00
Expanding /dev/sda2 using the 'pvresize' method ...
Expanding /dev/fedora/root using the 'resize2fs' method ...
Resize operation completed with no errors. Before deleting the old
disk, carefully check that the resized disk boots and works correctly.
-------------
-> Check the size of the both new guests
-------------
$ ls -lash f19-test.raw f19-test.raw.new
2.7G -rw-r--r--. 1 qemu qemu 10G Apr 10 11:12 f19-test.raw
11G -rw-r--r--. 1 root root 25G Apr 10 12:13 f19-test.raw.new
-------------
-> Copy the old one for backup,
-------------
$ mv f19-test.raw f19-test.raw.original
$ mv f19-test.raw.new f19-test.raw
$
-------------
-> List file systems inside the newly resized disk.
-------------
$ virt-filesystems --partitions --long -h -a f19-test.raw
Name Type MBR Size Parent
/dev/sda1 partition 83 500M /dev/sda
/dev/sda2 partition 8e 25G /dev/sda
-------------
-> Ensure the libvirt xml reflects the re-sized image:
-------------
$ grep source /etc/libvirt/qemu/f19-test.xml
-------------
-> Start a guest to access it via serial console
-------------
$ virsh start f19-test --console
-------------