Reduce compression size of vmware linux virtual machine on ext2,ext3 file system
As I need from time to time compress my vmware virtual machine I needed to find out the way to compress it to a minimum size possible. Even, I removed all unnecessary files from my file system the actual compressed file of my vmware virtual machine did not reduce on size. The reason for this is that with using ” rm ” Linux command I actually only removed file descriptor from the file system but file it self remained untouched. What I needed to do was, to mark all bits on my ext3 or ext2 file system to zero ( 0 ). To do that I simply cat /dev/zero and redirected output to a file:
cat /dev/zero > file
I left the command running until it filled up all available free space. This overrides all clusters of my ext3 or ext2 file system to 0. Then the only thing what is needed to be done, is to just simply remove file:
rm file
Now my compression tool has better compression ratio because it is better to compress all ” 0 ” rather than random bits or at least this my understanding of it. This simple trick should work on every files system. Let me know if you have better tips on how to reduce compression size of vmware virtual machine.
Filed under: Administration, Commands, Linux, vmware