Bug 832336 - block streaming "explodes" a qcow2 file to the full virtual size of the disk
block streaming "explodes" a qcow2 file to the full virtual size of the disk
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
6.3
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Paolo Bonzini
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-15 04:06 EDT by Paolo Bonzini
Modified: 2013-07-17 14:50 EDT (History)
12 users (show)

See Also:
Fixed In Version: qemu-kvm-0.12.1.2-2.320.el6
Doc Type: Bug Fix
Doc Text:
Running a block_stream operation on a qcow2 image allocated disk space for the entire image, causing the image to grow to the size of the virtual disk. Now, block streaming does not copy unallocated sectors from the backing file. The target image thus will not grow by more than the size of the backing file.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-02-21 08:07:40 EST
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)

  None (edit)
Description Paolo Bonzini 2012-06-15 04:06:41 EDT
From bug 582475 comment 34:
1. install a image(rhel63-64.qcow2)
   # qemu-img info rhel63-64.qcow2
   image: rhel63-64.qcow2
   file format: qcow2
   virtual size: 10G (10737418240 bytes)
   disk size: 2.1G
   cluster_size: 65536

2. create a src.qow2 with a backing file rhel63-64.qcow2
   # qemu-img create -f qcow2 -b rhel63-64.qcow2 -F qcow2 src.qcow2

3. start the guest in qemu cmd line with src.qcow2
4. (qemu) block-stream ide0-hd0
   # qemu-img info src.qcow2
   image: src.qcow2
   file format: qcow2
   virtual size: 10G (10737418240 bytes)
   disk size: 10G
   cluster_size: 65536

Expected results:
The size of src.qcow2 should be ~2.1G, roughly the same as rhel63-64.qcow2.

Actual results:
The size is 10G whereas the size of the backing file is 2.1G.

Additional information:
This was done by design in upstream QEMU and backported this way to RHEL.  We changed it before the 1.1 release in upstream QEMU, but it was too late for RHEL6.3.  We should backport the change.

Related to bug 808114.
Comment 1 RHEL Product and Program Management 2012-07-10 04:13:43 EDT
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.
Comment 2 RHEL Product and Program Management 2012-07-10 21:45:10 EDT
This request was erroneously removed from consideration in Red Hat Enterprise Linux 6.4, which is currently under development.  This request will be evaluated for inclusion in Red Hat Enterprise Linux 6.4.
Comment 7 Qunfang Zhang 2012-11-07 05:04:26 EST
Reproduced on qemu-kvm-rhev-0.12.1.2-2.295.el6.x86_64 and verified pass on qemu-kvm-rhev-0.12.1.2-2.334.el6.x86_64.

Steps.
1. Install a rhel6.3 qcow2 image
2. create snapshot src.qcow2.
# qemu-img create -f qcow2 -b rhel6.3-virtio.qcow2 -F qcow2 src.qcow2
# qemu-img info src.qcow2 
image: src.qcow2
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 136K
cluster_size: 65536
backing file: rhel6.3-virtio.qcow2

# qemu-img info rhel6.3-virtio.qcow2 
image: rhel6.3-virtio.qcow2
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 3.1G
cluster_size: 65536

3. Boot the src.qcow2 
(qemu) info block
disk0: removable=0 io-status=ok file=/home/src.qcow2 backing_file=rhel6.3-virtio.qcow2 ro=0 drv=qcow2 encrypted=0

4. (qemu) block-stream disk0
(qemu) info block-jobs 
Streaming device disk0: Completed 28377088 of 21474836480 bytes, speed limit 0 bytes/s

=============
On the old version qemu-kvm-rhev-0.12.1.2-2.295.el6.x86_64, it takes very long time to finish the block stream job. And after step 4 finished, the disk size of src.qcow2 is 20G, same as virtual size.

# qemu-img info src.qcow2 
image: src.qcow2
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 20G
cluster_size: 65536


On the fixed version qemu-kvm-rhev-0.12.1.2-2.334.el6.x86_64, the block stream job finishes quickly than old version. And finally the disk size is 3.1G, not 20G.

# qemu-img info src.qcow2 
image: src.qcow2
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 3.1G
cluster_size: 65536

Based on above, this issue is fixed.
Comment 10 errata-xmlrpc 2013-02-21 08:07:40 EST
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.

http://rhn.redhat.com/errata/RHBA-2013-0543.html

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