[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-discuss] QCOW2 real hard drive image
From: |
Jakob Bohm |
Subject: |
Re: [Qemu-discuss] QCOW2 real hard drive image |
Date: |
Tue, 28 Aug 2012 14:50:25 +0200 |
User-agent: |
Mozilla/5.0 (Windows NT 5.2; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0 |
On 8/27/2012 6:52 PM, Mike Lovell wrote:
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.
mike
An alternative may be to find a filesystem specific tool which can
filter out the unused sectors.
One possible tool (for ntfs) is the ntfsdump utility from ntfsprogs, it
may be able to do this with selected options.
Another possible tool is Partimage from partimage.org. It can copy a
disk skipping unused sectors for many file systems. To use it you would
need to attach an empty qcow2 image of proper size as a virtual disk
(e.g. using NMB) and then tell Partimage to do the cloning.
Another alternative is first create an uncompressed disk image, mount it
and run a free space wiping tool, unmount it and then tell qemu-img to
create an image from it.
All 3 approaches involve using file system specific tools to figure out
which disk sectors are unused.
P.S.
The phrase "dirty sector" normally refers to a sector whose data has not
been completely saved to disk yet. Which is kind of the opposite of an
unused sector.
Enjoy
Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S. http://www.wisemo.com
Transformervej 29, 2730 Herlev, Denmark. Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded