You will hit an error with your e2fsck version. In my case the issue happened in Centos7, when I try to expand the disk for a fedora34 qcow2 image.
qemu-img resize fedora-new.qcow2 +20G
You will hit an error with your e2fsck version. You will need to download the latest source binary of e2fsprogs from your OS distributor and install it.
[ 17.0] Resizing (using virt-resize) to expand the disk to 8.0G virt-resize: error: libguestfs error: resize2fs: e2fsck 1.42.9 (28-Dec-2013) /dev/sda1 has unsupported feature(s): metadata_csum e2fsck: Get a newer version of e2fsck! If reporting bugs, run virt-resize with debugging enabled and include the complete output:
Solution: Get a newer version of e2fsck
To install it from on CentOS 7. You will also need to install libguestfs-xfs
on CentOS 7 to handle XFS file system with virt-builder
utility. Otherwise you will hit below error. Get a newer version of e2fsck for virt-resize
sudo wget https://mirrors.edge.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.45.6/ sudo tar -xf e2fsprogs-1.45.6.tar.xz sudo cd e2fsprogs-1.45.6 sudo ./configure sudo make sudo make install sudo yum -y install libguestfs-xfs
Now you should be able to expand your fedora disk
virt-builder -o f34.qcow2 --size 28G fedora-34
Thanks!
Information Source:
More info at How to install custom Gitlab runners with libvirt executor