From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50870) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQcaA-0001aQ-2n for qemu-devel@nongnu.org; Fri, 12 Apr 2013 07:55:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQca7-0002Nz-6Q for qemu-devel@nongnu.org; Fri, 12 Apr 2013 07:55:53 -0400 Received: from mta2.ware.fi ([178.217.132.218]:26755) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQca6-0002NG-Om for qemu-devel@nongnu.org; Fri, 12 Apr 2013 07:55:51 -0400 Received: from localhost (unknown [127.0.0.2]) by mta2.ware.fi (Postfix) with ESMTP id F170B2703CF for ; Fri, 12 Apr 2013 14:55:45 +0300 (EEST) Received: from ruuvari.hard.ware.fi (fw-spy.hard.ware.fi [10.31.32.1]) by mta2.i.ware.fi (Postfix) with ESMTP id CC379270306 for ; Fri, 12 Apr 2013 14:55:45 +0300 (EEST) Message-ID: <5167F641.8090004@cybercom.com> Date: Fri, 12 Apr 2013 14:55:45 +0300 From: Ilkka Tengvall MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] qemu-img: error while compressing, Input/output error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org I run into an issue where qemu-img convert fails repeatedly on compressing a raw disk image. It's not all broken, since it many times also works. When it fails, it fails always to the same sector. I run into problem using f18 qemu-img-1.2.2-6.fc18.x86_64, and repeated it with the latest qemu-img from qemu git as of 12th of April 2013: last git log: 93b48c201eb6c0404d15550a0eaa3c0f7937e35e I discussed the problem on IRC on qemu channel with stefanha, and he asked me to provide the info here. Thanks for you help stefanha! Here is some background snipplets: " anyone having idea why "qemu-img convert -c -O qcow2 -f raw file1 file1.qcow2" would fail to: qemu-img: error while compressing sector 1842944: Input/output error ikke: My guess is that qcow2_alloc_compressed_cluster_offset() is failing Compressed writes cannot overwrite existing sectors, perhaps there's a bug in qemu-img convert that causes it to touch the same sector twice. We wouldn't notice it when compression is disabled. But when it's enabled you get a failure. stefanha: by the way, is it right that qemu-img.c:1372 calculates cluster_sectors from cluster_size by rounding down rather than up? I know nothing about this code but that looks a little suspicious And the contents of the input image affect the I/O pattern during conversion which would explain why you always get the problem with certain images. pm215: That should be okay. cluster_size is a power of 2 and multiple of 512. For qcow2 the default cluster_size is 64 KB. ikke: A post to the mailing list with a link to the file and a description of how to trigger the failure would be fine. I think it won't take long to fix. " The image for repeating this is available here (~230MB): http://hard.ware.fi/~ikke/stuff/ubuntufs.raw.img.gzip and the command to reproduce the error is here: $ qemu-img convert -c -O qcow2 -f raw root.fs.copy root.fs.small.new qemu-img: error while compressing sector 1842944: Input/output error BR, Ilkka Tengvall ilkka.tengvall@cybercom.com