GhettoVCB, the Free Backup Solution for VMware ESXi

GhettoVCB, the Free Backup Solution for VMware ESXi
Jérémie Kassianoff
October 8, 2013
2 min read

Can't back up a VM without powering it off? GhettoVCB is the essential solution! It performs hot backups of your ESXi VMs.

Real-world use case

You need to back up an ESXi VM without powering it off or paying for a license: discover GhettoVCB, the free solution.

The free version of VMware ESXi doesn't offer hot backup of virtual machines.
A script developed by Virtuallyghetto, called GhettoVCB, lets you get around this problem!
GhettoVCB's GitHub page is available at this address: GhettoVCB
In this article, we'll stick to the essentials.

Preparing ghettoVCB

Download all the files by clicking Download ZIP.
Then go to your hypervisor to transfer ghettoVCB-master.zip.
Now, connect to your hypervisor via SSH.

Our working directory will be: /vmfs/volumes/datastore1/ghettoVCB.
It's strongly recommended to put it on a local datastore and copy it into a folder.

ghettoVCB in the ESXi 5 hypervisor

Unzip your zip file:

bash
unzip ghettoVCB-master.zip

Make your script executable:

bash
chmod +x ghettoVCB.sh

Edit your ghettoVCB.sh file:

bash
vi ghettoVCB.sh

Edit the following variables:

bash
VM_BACKUP_VOLUME=/vmfs/volumes/52304bd6-af562afc-e5fa-08606ee5bd47/backups
VM_BACKUP_ROTATION_COUNT=2

"52304bd6-af562afc-e5fa-08606ee5bd47" corresponds to my datastore 2.

Create a listvm file:

bash
touch listvm

Add the VM names:

bash
core.vyatta.master
core.vyatta.slave
srv.owncloud
srv.zimbra
srv.zpush

Look for the "crond" process:

bash
ps | grep crond | grep -v grep
==> 3255 23255 crond                crond

Kill the cron process:

bash
kill 3255

Update the cron permissions:

bash
chmod 644 /var/spool/cron/crontabs/root
chmod +t /var/spool/cron/crontabs/root

Schedule the cron job:

bash
vi /var/spool/cron/crontabs/root

Add this line to the cron:

bash
0    0    *   *   1   /vmfs/volumes/5230458e-84f00e58-8db6-08606ee5bd47/ghettoVCB/ghettoVCB.sh -f /vmfs/volumes/5230458e-84f00e58-8db6-08606ee5bd47/ghettoVCB/listvm

Go to the rc.local file:

bash
vi /etc/rc.local

For version 5.1:

bash
vi /etc/rc.local.d/local.sh

Add this:

bash
/bin/echo "0    0    *   *   1   /vmfs/volumes/5230458e-84f00e58-8db6-08606ee5bd47/ghettoVCB/ghettoVCB.sh -f /vmfs/volumes/5230458e-84f00e58-8db6-08606ee5bd47/ghettoVCB/listvm" >> /var/spool/cron/crontabs/root

Restart cron:

bash
crond

To test the script works correctly:

bash
/vmfs/volumes/5230458e-84f00e58-8db6-08606ee5bd47/ghettoVCB/ghettoVCB.sh -f /vmfs/volumes/5230458e-84f00e58-8db6-08606ee5bd47/ghettoVCB/listvm

Check my datastore2:

For more details on the commands: GhettoVCB.

Conclusion

I detailed here how to set up GhettoVCB to work around the lack of hot backup for virtual machines in the free version of VMware ESXi. Configuring the script, from the list of VMs to back up to scheduling via cron and automatic startup when the hypervisor boots, provides a simple, free backup solution. It's a valuable alternative for ESXi environments that don't have a license enabling native backups.