On Thu, Mar 10, 2011 at 12:09:08PM -0700, Joseph Hall wrote:
>
>Question 1: Why is my non-sparse file full of zeros, sitting inside
>the filesystem inside the new sparse file, not taking up a lot of
>space?

cp creates holes for sparse files from long sequences of 0's.

This leads to a handy trick when you are copying a VM disk image. If the
VM has been running for a while and writing/unlinking files, you can do:

dd if=/dev/zero of=/tmp/foo; rm -f /tmp/foo

Then shutdown the VM, copy the disk image with "cp --sparse=always", and
your new disk image file should be much smaller.

-Peter

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to