Bug 1167249 - qemu-img disk corruption
Summary: qemu-img disk corruption
Alias: None
Product: Fedora
Classification: Fedora
Component: qemu
Version: 21
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Fedora Virtualization Maintainers
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2014-11-24 09:58 UTC by Tony Breeds
Modified: 2014-12-12 04:26 UTC (History)
11 users (show)

Fixed In Version: qemu-2.1.2-7.fc21
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2014-12-12 04:26:43 UTC

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Bugzilla 1142331 None None None Never
Launchpad 1368815 None None None Never

Description Tony Breeds 2014-11-24 09:58:13 UTC
Description of problem:
When using qemu-img convert to/from raw format on files that are not fully flushed to disk corrupt disk images can result.

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

Affects F19 F20 and F21.  Fixed in rawhide.

I know it's a little tacky to point to another distro's bug tracker but please see the ubuntu bug referenced below.

It contains the patches to backport to the affected current releases.

Comment 1 Richard W.M. Jones 2014-11-24 10:23:49 UTC
I've seen something like this with virt-builder, which required
virt-builder to fsync the image after writing it.  In fact
we document it.  Search the following page for '--no-sync':


Comment 2 Richard W.M. Jones 2014-11-24 10:24:57 UTC
BTW I think your explanation in the launchpad bug may be wrong
(or maybe there are two separate issues).  The issue we had is
that the default cache mode in qemu is directsync (using O_DIRECT)
so it bypasses the cache, and using qemu-img before or after qemu
causes it to not read data which is cached and not written to disk.

Comment 3 Tony Breeds 2014-11-24 10:59:46 UTC
I'm pretty sure there are 2 issues.  I've certainly see the issue you describe above, but not in an openstack context.

In our case the source image is fine. and NOT controlled by qemu (at this point) so it's pretty easy to rule out qemu's cacheing or IO models.

Comment 4 Tony Breeds 2014-11-24 11:01:09 UTC
FWIW I've included a link to the RHEL bug for this issue.

Comment 5 Cole Robinson 2014-11-25 15:35:30 UTC
From https://bugs.launchpad.net/qemu/+bug/1368815/comments/8:

FWIW the following 2 commits in qemu master resolve the issue for qemu-img.


If possible they should be back ported to trusty and utopic.

You'll also need something like:


before my 2 patches.

Comment 6 Fedora Update System 2014-12-01 15:24:29 UTC
qemu-2.1.2-7.fc21 has been submitted as an update for Fedora 21.

Comment 7 Fedora Update System 2014-12-02 01:03:55 UTC
Package qemu-2.1.2-7.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing qemu-2.1.2-7.fc21'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).

Comment 8 Pádraig Brady 2014-12-02 10:55:43 UTC
Updated package works on F21.
I've confirmed the fiemap code issue affects F19 and F20 also

Comment 9 Fedora Update System 2014-12-12 04:26:43 UTC
qemu-2.1.2-7.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

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