[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-discuss] QCOW2 real hard drive image

From: Mike Lovell
Subject: Re: [Qemu-discuss] QCOW2 real hard drive image
Date: Tue, 28 Aug 2012 10:30:54 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0

On 08/28/2012 02:02 AM, Jerzy Grzegorek wrote:
Dnia 27-08-2012 o godz. 18:52 Mike Lovell napisaƂ(a):
On 08/18/2012 02:03 AM, Jerzy Grzegorek wrote:
I'd like to create the smallest possible qcow2 (or other format) real
hard drive image. It is possible to create it without "dirty" no used
sectors in the way like this (with additional options)

qemu-img convert -f raw /dev/sda -O qcow2 disk.qcow2.img

unfortunately, i don't think qemu-img can determine whether or not a
sector is 'dirty.' i'm guessing by 'dirty' you mean a sector that has
had data written to it but the file system on top no longer needs the
data because the file was removed or truncated or similar. determining
which sector is 'dirty' in this case would depend on knowing what
filesystem is used and what parts of the disk the filesystem currently
has allocated and what is free space. i don't think qemu-img can do this.

you could try just adding -c to the command you listed and qemu-img will
create a compressed qcow2. that could reduce the size of the resulting
image significantly. other than that, compressing it further would take
additional steps.

Thanks Mike for your reply.
And what do you think about zeroing non used sectors before making and 
compressing this image?
Is it a safe and simple enough way to do it? I think it will have influence to 
compression ratio. Am I right?


add'ing the mailing list back to the recipients.

if you can zero the sectors that the filesystem is not currently using then it should help the compression significantly. also, i saw some commits to the qemu block layer a couple months ago to handle efficient writing of zero-ed blocks. so if you are using a recent qemu-img and a block format that the driver supports the zero-ed blocks, it should efficiently handle those.

unfortunately, i don't have much for you by way of how to zero out those blocks. i don't know what file system(s) your using and this isn't something i have tried myself yet. i'm also a little skeptical of suggesting a method since i don't want to be blamed if it breaks and destroys your data. :)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]