enira.net

We are all living in a technological wasteland.

RSS
people

Shrinking VMWare Images

Sometimes it’s possible that VMWare images become quite large, this is completely normal as files are added and deleted. Usually this isn’t such a problem on machines which are running constantly. But when you need to transfer disk images trough the net, or store disk files every byte sometimes counts.

As an experiment I’ve shrunk the disk images from the Slitaz project.

Shrinking

First enter the os you wish to shrink and zerofill the disk images.

dd if=/dev/zero of=/home/base/wipe.file
rm /home/base/wipe.file

If there are additional storage locations mounted by added disks, then create a zero image there too. The Gluster nodes uses ‘/mnt/data/’ and the mysql uses ‘/var/lib/mysql/’.

Then shutdown the machine and run a command line from your host system.

cd "c:\Program Files (x86)\VMware\VMware Workstation"

Once you are in the folder use the vmware-vdiskmanager to decrease the vmdk files:

vmware-vdiskmanager.exe -k "drag vmdk file here"

Results

mysql.7z             old: 45.6 MB         new: 20.7 MB        saved: 55%
glusternodes.7z      old: 254 MB          new: 165 MB         saved: 35%
glusterclient.7z     old: 78.7 MB         new: 50.9 MB        saved: 35%
webnodes.7z          old: 253 MB          new: 159 MB         saved: 37%
loadbalancers.7z     old: 124 MB          new: 67.1 MB        saved: 46%

The results are clearly astonishing. The lowest space decrease is 35% while the biggest one is 55% of space saved. In total I’ve decreased the file size on my webhost by 292.6 MB! That’s enough.

 

Leave a Reply

You must be logged in to post a comment.