How to shrink your full VM-Backups (Windows/Linux)

D. Heinrich
1 min readApr 16, 2018

How to Backup VMware VMs?

If you’ve no salery cap left, like me. You want to use an Open-Source tool.
I’d love to use GhettoVCB: On Github

I’ll list some usecaeses below.

My environment contains:

  • ESX 6.5
  • NFS-Server

Usecases:

Backup single VM:

  • Backup VMs including a list:
$ ./ghettoVCB.sh -m "<VM name>" -g /opt/ghettovcb/conf/backup.conf
  • Backup VMs with an excluding list:
    NOTE:
    - vm2 and vm4 will be backed up
    - vm1, vm3 and vm5 will be excluded from the Backup
$ cat vm_exclusion_listvm1
vm3
vm5
$ ./ghettoVCB.sh -a -e vm_exclusion_list
  • Backup all VMs on ESX:
$ ./ghettoVCB.sh -a -g /opt/ghettovcb/conf/backup.conf

If your backup is bigger than your used diskspace than you’ve junk left on your harddrive (which was alread deleted).

Before:

$ df -hd 1
336G ./jenkins-2018-04-15

In this case, you’ve to override it with zeroes, to make your thin-provisioned disk small again.

To do so you just have to type the following command:

Single partition systems:

Linux:

$ df -h ; time dd if=/dev/zero of=/EMPTY ; df -h ; time rm -f /EMPTY

Windows:

Download sdelete (windows utility)

$ sdelete -z c:

Multi partition systems:

If you have multiple disks (var for example), you should use something like this:

$ dd if=/dev/zero of=/var/EMPTY ; df -h ; time rm -f /var/EMPTY

If you now backup again, you’ll see that only mostly your used diskspace will remain in your backup.

After overriding the free space with zero’s:

$ df -hd 1
336G ./jenkins-2018-04-15
292G ./jenkins-2018-04-16

--

--

D. Heinrich

Working as a Head of Infrastructure at Flower Labs.