[CentOS-virt] compress raw image
linux at esiway.net
Mon Aug 8 12:06:59 EDT 2011
On 08/04/2011 10:59 PM, Izaac wrote:
> On Thu, Aug 04, 2011 at 04:35:20PM +0200, Rainer Traut wrote:
>> I need to transfer a local raw image to another datacenter.
>> Is there a way to achieve good compression of this image, I heard of
>> tools overwriting unused space with zeros. Is this a good idea?
> You're talking about sparse files? You probably want to use rsync with
> --sparse to keep the file from inflating on the far side. Something
> rsync -ctrvlzSP source.raw user at destination:source.raw
No, he's talking filling with zeros unused blocks. That's a prerequisite
to optimize for a sparse image _on the other side_ and/or compression
during the transfer.
I know of an ext2/3/4 utility that does precisely that. I have no idea
if such an utility exists for NTFS. Poor man's solution is to create a
file filled with zero as big as the free space in the filesystem (or a
set of files). It should not be sparse (assuming NTFS supports sparse
files). Then you remove it, stop the virtual machine and now you can
compress the image at best (you can use -z option to rsync, or use a
compression utility and then transfer the image, but using both doesn't
More information about the CentOS-virt