First, convert it to raw:
qemu-img convert system.qcow2 -O raw system.raw
Then use DD to append a zero all the way at the end of the new file. It will automatically create a hole in the file:
# Make sure the seek value is bigger than the file size, otherwise it would put a zero somewhere in the middle of the file. dd if=/dev/zero of=temp.raw bs=1 count=1 seek=100G
Then resize the partition. I did that by binding the image to a loop device:
losetup /dev/loop0 system.raw
Then you can use fdisk on /dev/loop0 to alter the partition table. parted didn’t want to resize my file sytem because it had a journal (argh…) so I just used fdisk and made sure that the start of the partition was the same.
Then you detach the loop device and attach the partition:
losetup -d /dev/loop0 # 32256 is 63*512. 63 is the start sector, which fdisk can tell you (with the u option) losetup -o 32256 /dev/loop0 system.raw
Then I used resize2fs on /dev/loop0 and detached it again.