From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:44020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RYdEh-0001VA-Da for qemu-devel@nongnu.org; Thu, 08 Dec 2011 07:38:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RYdEd-0002p1-DT for qemu-devel@nongnu.org; Thu, 08 Dec 2011 07:38:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38019) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RYdEd-0002ov-1g for qemu-devel@nongnu.org; Thu, 08 Dec 2011 07:37:59 -0500 Message-ID: <4EE0B059.4010903@redhat.com> Date: Thu, 08 Dec 2011 13:40:57 +0100 From: Kevin Wolf MIME-Version: 1.0 References: <958CDBC95A3252B592B5E3C9@nimrod.local> In-Reply-To: <958CDBC95A3252B592B5E3C9@nimrod.local> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] RFC: raw device support for block device targets List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Bligh Cc: qemu-devel@nongnu.org Am 06.12.2011 17:20, schrieb Alex Bligh: > qemu-img convert appears to support block devices as input, but not > as output. That is irritating, as when using qemu-img convert to > convert qcow to raw on a block partition, an intermediate file has > to be used, which slows things down and pointlessly uses disk space. > > The problem is that ftruncate() is being called on the output file > in order ensure it is sufficiently large, and this fails on > block devices. > > I appreciate there may be other calls that fail depending on the > input file format, but these will presumably be error checked > at the time. > > Is it therefore worth skipping the ftruncate() if the block device > is large enough, and at least attempting to proceed further? Something > like the following (not-even compile tested) patch? Creating an image on a block device shouldn't even call raw_create(), but only hdev_create(), which doesn't try to truncate the device, but just uses lseek to make sure that it's large enough. Which qemu version are you using and what's your command line? Kevin