We have a few linux based (Centos) virtual machines which are to be used as distributable virtual appliances. We want to be able to compress them as much as possible for distribution ( via tar.gz, zip, etc).
We've removed all unnecessary files (.log's, /tmp/*, /var/log/, etc) and have written /dev/zero to the free space on the disk.
Is it possible to write zeros via /dev/zero to the swap partitions and files? I know I would need to swapoff -a first. I'm worried about corrupting any internal structures.
Our vm uses both partition swap and file swap.
Also, are there any other strategies for reducing the size of a VM for distribution?
We need to support all of the hypervisor technologies (Xen, VMW, etc), so although the vendors tools maybe useful, I'm looking for strategies that are cross platform.
--- Thanks
You may want to write zeroes and then use mkswap to create an empty swap partition.