This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 974904 - virt-resize --expand fails on Ubuntu Cloud Image
virt-resize --expand fails on Ubuntu Cloud Image
Status: CLOSED UPSTREAM
Product: Virtualization Tools
Classification: Community
Component: libguestfs (Show other bugs)
unspecified
x86_64 Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: Richard W.M. Jones
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-17 01:56 EDT by David Hart
Modified: 2013-06-19 14:09 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-06-19 14:09:37 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
output of virt-resize --debug (6.70 KB, text/plain)
2013-06-19 04:54 EDT, David Hart
no flags Details

  None (edit)
Description David Hart 2013-06-17 01:56:01 EDT
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
Comment 1 Richard W.M. Jones 2013-06-17 07:56:45 EDT
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.
Comment 2 David Hart 2013-06-19 04:54:21 EDT
Created attachment 762795 [details]
output of virt-resize --debug
Comment 3 David Hart 2013-06-19 04:56:51 EDT
virt-resize --resize /dev/sda1=+6G

Works as expected.
Comment 4 Richard W.M. Jones 2013-06-19 05:43:25 EDT
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.")
Comment 5 Richard W.M. Jones 2013-06-19 14:09:37 EDT
Fixed upstream by this patch:
https://github.com/libguestfs/libguestfs/commit/b730bc0c4685887232daed8fafa491b28f38c300

Note You need to log in before you can comment on or make changes to this bug.