Archive for July, 2014

VMware free backup solution from virtuallyGhetto


VMware free backup solution for ESXi servers:

Download the script from github: then modify it for your system to fit in.

I’m going to explain the important parts that I usually change in this script:

In file:

– Backup path
– Rotation
– Backup format
– Email server
– Email to
– Email from


# directory that all VM backups should go (e.g. /vmfs/volumes/SAN_LUN1/mybackupdir)


# Format output of VMDK backup
# zeroedthick
# 2gbsparse
# thin
# eagerzeroedthick


# Number of backups for a given VM before deleting

Also in ghettoVCB.conf







When you uploaded the and ghettovcb.conf files you need to add execute flag to the file:

chmod +x

Then you can start backing up your VM machines.

Backup only one machine run this:

./ -m vm_to_backup

Backup all machines:

./ -a

If you want to machine to be avoided from backup then use an except file to achive this:
./ -a -e vm_exclusion_list

VMware firewall wont let allow to send outgoing emails from the script, this need to be fixed.
Upload smtp.xml file to VMware server and update the firewall, with out this you will receive an error on VMware ssh console.

Script:  smtp.xml

Upload it to /etc/vmware/firewall and run esxcli update:

esxcli network firewall refresh

Then click on server name, configuration, security profile and you will see the new smtp outbond port appeared as a new outgoing firewall rule to allow smtp outgoing traffic from the server.




Altough you can use the restore script: to restore machines from backup, but you can use them straight away when you add to your machine from the backup script.
This is much quicker then the restore process, but obviously the machine will reside on the backup path not on the original path. With this you can get back the machine ASAP, then create a backup onto the original path and shut down the backup path machine and add to the inventory the original path machine and start it up.


Only one thing left to do is to make this process be automatic.
Edit crontab on your server and add this to it:
10 00 * * 1-5 /vmfs/volumes/ -f /vmfs/volumes/Fuji-NAS/backuplist > /vmfs/volumes/ghettoVCB-backup-$(date +\%s).log

Crontab file located on VMware ESXi 5.5 at: /var/spool/crontabs/ and root file contains the current configuration for crontab.

cat /var/spool/cron/crontabs/root

#min hour day mon dow command
1 1 * * * /sbin/
1 * * * * /sbin/
0 * * * * /usr/lib/vmware/vmksummary/
*/5 * * * * /sbin/hostd-probe ++group=host/vim/vmvisor/hostd-probe
10 00 * * 1-5 /vmfs/volumes/datastore1/root/opt/ -f /vmfs/volumes/datastore1/root/opt/vmbackup.txt

This will run backup on every day at 10'o clock, but you can change it according to your needs.
Show Buttons
Hide Buttons