RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1172660 - virt-resize --expand fails on ubuntu-14.04.img image
Summary: virt-resize --expand fails on ubuntu-14.04.img image
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.2
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On: 1169015
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-10 14:13 UTC by Richard W.M. Jones
Modified: 2015-11-19 06:58 UTC (History)
8 users (show)

Fixed In Version: libguestfs-1.28.1-1.25.el7
Doc Type: Bug Fix
Doc Text:
Clone Of: 1169015
Environment:
Last Closed: 2015-11-19 06:58:12 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2183 0 normal SHIPPED_LIVE libguestfs bug fix and enhancement update 2015-11-19 08:18:42 UTC

Description Richard W.M. Jones 2014-12-10 14:13:45 UTC
+++ This bug was initially created as a clone of Bug #1169015 +++

Description of problem:

virt-resize fails with an "write: No space left on device" error when trying to expand the http://libguestfs.org/download/builder/ubuntu-14.04.xz image.

I encountered this error by running virt-builder with --size=10G on Fedora 21. It used to work on Fedora 20.

Version-Release number of selected component (if applicable):

rpm -q libguestfs-tools-c 
libguestfs-tools-c-1.28.2-3.fc21.x86_64

Steps to Reproduce:
1. curl http://libguestfs.org/download/builder/ubuntu-14.04.xz | xz -cd > ubuntu-14.04.img
2. virt-resize -v -x --expand=/dev/sda1 ubuntu-14.04.img 10G.img 2>&1  | tee virt-resize-log.txt

Actual results:

virt-resize: error: libguestfs error: copy_device_to_device: /dev/sdb2: 
write: No space left on device

(full detail in attached log file)

--- Additional comment from Sylvain Pasche on 2014-11-28 17:48:27 EST ---

I forgot the "truncate -s10G 10G.img" command just before running virt-resize.

--- Additional comment from Richard W.M. Jones on 2014-11-29 02:26:44 EST ---

I suspect https://github.com/libguestfs/libguestfs/commit/fc34e2d16c2d13d6ae7a381ba931e345ab5ae56d
(which I don't think is wrong) which changes the type
we use when creating the extended partition.  Previously
it would create it as "primary", now it is created as
"extended".

--- Additional comment from Sylvain Pasche on 2014-11-29 08:28:53 EST ---

Looks like it is, if I revert that change it succeeds (tried with libguestfs-1.29.11).

--- Additional comment from Hu Tao on 2014-12-07 22:26:21 EST ---



--- Additional comment from Hu Tao on 2014-12-07 22:29:22 EST ---

Please try the attached patch and feedback. Thanks!

The root cause of the problem is that the size of an extended partition reported by Linux is alwas 1024 bytes, so when you are writing to the device (such as /dev/sdb2) corresponding to the extended partition, you can only write 1024 bytes.

--- Additional comment from Richard W.M. Jones on 2014-12-08 09:11:21 EST ---

Hu Tao's patch has gone upstream, please try it out:

https://github.com/libguestfs/libguestfs/commit/9d6f0b6a86d68438b27a3d783677c63f39ec6627

--- Additional comment from Sylvain Pasche on 2014-12-09 15:33:34 EST ---

I tried the patch on top of libguestfs-1.29.13 and the resizing succeeds now with ubuntu-14.04.img.

Thanks!

--- Additional comment from Richard W.M. Jones on 2014-12-10 09:13:10 EST ---

Closing / upstream.

This is likely to be a problem on Fedora 21 & RHEL 7.1 too,
so I am going to clone it.

Comment 1 Hu Zhang 2015-01-15 08:04:40 UTC
Reproduced this bug with the package:
libguestfs-tools-c-1.28.1-1.18.el7.x86_64

Reproduce steps:
1. truncate -s 10G 10G.img
2. virt-resize -v -x --expand=/dev/sda1 ubuntu-14.04.img 10G.img 2>&1  | tee virt-resize-log.txt

Error returns:
libguestfs: trace: copy_device_to_device = -1 (error)
virt-resize: error: libguestfs error: copy_device_to_device: /dev/sdb2: 
write: No space left on device

Comment 2 Richard W.M. Jones 2015-04-13 13:42:13 UTC
A simpler reproducer for this is:

  $ virt-builder ubuntu-14.04 --size 50G

With 1:libguestfs-tools-c-1.28.1-1.18.el7.x86_64 this will
fail with an error message:

[  10.0] Resizing (using virt-resize) to expand the disk to 50.0G
virt-resize: error: libguestfs error: copy_device_to_device: /dev/sdb2: 
write: No space left on device

With the fixed virt-builder, you should see the virt-builder complete
successfully.

Comment 4 Hu Zhang 2015-09-11 10:49:41 UTC
Verified with the package:
libguestfs-tools-c-1.28.1-1.52.el7.x86_64

Verify steps:
1. truncate -s 10G 10G.img
2. virt-resize -v -x --expand=/dev/sda1 ubuntu-14.04.img 10G.img 2>&1  | tee virt-resize-log.txt
...
libguestfs: calling virDomainDestroy "guestfs-3p0icg9ei6m89bsq" flags=VIR_DOMAIN_DESTROY_GRACEFUL
libguestfs: trace: shutdown = 0
libguestfs: trace: close
libguestfs: closing guestfs handle 0xdd4f10 (state 0)
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /tmp/libguestfsLLzpkF

Resize operation completed with no errors.  Before deleting the old disk, 
carefully check that the resized disk boots and works correctly.

So no errors return. Verified.

Comment 6 errata-xmlrpc 2015-11-19 06:58:12 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2183.html


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