virt-resize 1.18.10 Steps to Reproduce: wget http://cloud-images.ubuntu.com/releases/precise/release/ubuntu-12.04-server-cloudimg-amd64-disk1.img qemu-img create -f qcow2 ubuntu-12.04-server-cloudimg-amd64-resized.img 8G sudo virt-resize --expand /dev/sda1 ubuntu-12.04-server-cloudimg-amd64-disk1.img ubuntu-12.04-server-cloudimg-amd64-resized.img Actual results: Examining /home/dhart/ubuntu-12.04-server-cloudimg-amd64-disk1.img ... W: kvm binary is deprecated, please use qemu-system-x86_64 instead ********** Summary of changes: /dev/sda1: This partition will be resized from 2.0G to 8.0G. The filesystem ext4 on /dev/sda1 will be expanded using the 'resize2fs' method. ********** Setting up initial partition table on /tmp/ubuntu-12.04-server-cloudimg-amd64-resized.img ... Fatal error: exception Guestfs.Error("part_add: parted: /dev/vdb: Error: The location 16788991s is outside of the device /dev/vdb.") Additional info: %qemu-img info ubuntu-12.04-server-cloudimg-amd64-disk1.img image: ubuntu-12.04-server-cloudimg-amd64-disk1.img file format: qcow2 virtual size: 2.0G (2147483648 bytes) disk size: 241M cluster_size: 65536
Thanks for reporting this. Can you run it again with the --debug option. It will produce a large amount of output which you should paste or attach *complete* to this bug.
Created attachment 762795 [details] output of virt-resize --debug
virt-resize --resize /dev/sda1=+6G Works as expected.
I can reproduce this problem with libguestfs 1.23.5. Here is a simple reproducer: $ guestfish Welcome to guestfish, the guest filesystem shell for editing virtual machine filesystems and disk images. Type: 'help' for help on commands 'man' to read the manual 'quit' to quit the shell ><fs> sparse test.img 2147483648 ><fs> run ><fs> part-init /dev/sda msdos ><fs> part-add /dev/sda p 16065 4192964 ><fs> part-list /dev/sda [0] = { part_num: 1 part_start: 8225280 part_end: 2146798079 part_size: 2138572800 } ><fs> exit $ truncate -s 8589934592 resized.img $ virt-resize --expand /dev/sda1 test.img resized.img Examining test.img ... ********** Summary of changes: /dev/sda1: This partition will be resized from 2.0G to 8.0G. ********** Setting up initial partition table on resized.img ... Fatal error: exception Guestfs.Error("part_add: parted: /dev/sdb: Error: The location 16788991s is outside of the device /dev/sdb.")
Fixed upstream by this patch: https://github.com/libguestfs/libguestfs/commit/b730bc0c4685887232daed8fafa491b28f38c300