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