Created attachment 1026269 [details] debugging output Description of problem: virt-builder fails if the --size parameter is given Version-Release number of selected component (if applicable): Debian package 1:1.29.40-1 How reproducible: Consistently Steps to Reproduce: 1. virt-builder $distro --size 8G 2. 3. Actual results: You cannot change a partition into an extended one or vice versa. Delete it first. sfdisk: /dev/sdb: partition 2: failed to set partition type [ 19.396359] sdb: sdb1 sdb2 < sdb5 > guestfsd: error: sfdisk --part-type: You cannot change a partition into an extended one or vice versa. Delete it first. sfdisk: /dev/sdb: partition 2: failed to set partition type guestfsd: mainvirt-resize: error: libguestfs error: part_set_mbr_id: sfdisk --part-type: You cannot change a partition into an extended one or vice versa. Delete it first. sfdisk: /dev/sdb: partition 2: failed to set partition type Expected results: This operation completing as it did with a previous version. Additional info:
Note: /mnt (as seen in the logs) is a scratch space with 32GB free.
The key to this puzzle is what is $distro? Anyhow this happens because virt-resize cannot resize logical partitions: http://libguestfs.org/virt-resize.1.html#logical-partitions so if you point the 'expand' setting at one it isn't going to work. There is ongoing work upstream to try to support logical partitions in virt-resize -- see upstream mailing list passim ad nauseam.
In this case $distro was both debian-7 and debian-8. I found that the culprit is util-linux 2.26.2-3 from Sid. It works with util-linux 2.25.2-6 from Jessie & Stretch.
Created attachment 1028171 [details] resize.txt I think this is because of the upstream rewrite of sfdisk. See also: https://www.redhat.com/archives/libguestfs/2015-May/msg00080.html I can reproduce this with util-linux-2.26.2-1.fc23.x86_64 Full log is attached.
This is a known regression in util-linux 2.26.x, see also https://bugzilla.redhat.com/show_bug.cgi?id=1248115#c7 Regarding Debian, either you ask the Debian maintainer of util-linux to backport the upstream commit to the 2.26.2 currently in testing & unstable, or simply wait for util-linux 2.27 to be released and packaged in Debian unstable.
OK. I'm still having the problem with 2.27-rc2 which is available in Debian experimental but I'll try hunting down the commit for 2.26. Thanks.