Backing up VMware ESXi VMs with ghettoVCB

Backups are important – and VMs should be no exception to that. VMware does have their own official backup solution (vSphere Data Protection), however if you’re running on the free version of ESXi or want something a little bit less resource-heavy, ghettoVCB is a good, and free, alternative – perfect for a home lab!


  • SSH access to your ESXi host.
  • A datastore, preferably a remote NFS or iSCSI one, where backups can be stored.


  1. Download the ghettoVCB VIB and then using your tool of choice (e.g. the vSphere Client or FileZilla over SFTP), transfer the VIB to your ESXi host.
  2. Connect to your ESXi host over SSH and enable the installation of “community” packages using the command esxcli software acceptance set –level=CommunitySupported . By default, ESXi will only allow the installation of official packages, so unless the acceptance level is set to Community Supported, installation of ghettoVCB will fail.
  3. Install the ghettoVCB VIB using the command esxcli software vib install -v /path/to/vghetto-ghettoVCB.vib -f . If you used the vSphere Client to upload it to a datastore, you can find it at /vmfs/volumes/DATASTORENAME/vghetto-ghettoVCB.vib.

If the installation was successful, you should see the following output;

Installation Result
   Message: Operation finished successfully.
   Reboot Required: false
   VIBs Installed: virtuallyGhetto_bootbank_ghettoVCB_1.0.0-0.0.0
   VIBs Removed:
   VIBs Skipped:

You can also verify that the installation was successful by navigating to /opt/ghettovcb/bin . If successful, there should be two files in here –  and .


  1. Using the text editor of your choice (e.g. vi ), edit /opt/ghettovcb/ghettoVCB.conf .
  2. Copy the example configuration from and paste it in to the new file.
  3. Adjust the configuration values as desired. Important values are;
  • VM_BACKUP_VOLUME – The path to your datastore where backups will be stored. For example, if your datastore was called “ISCSI-DATASTORE” and you wanted to store backups inside a folder called “Backups”, you would set this to /vmfs/volumes/ISCSI-DATASTORE/Backups .
  • VM_BACKUP_ROTATION_COUNT – The number of backups you wish to retain for each VM. Once more than this number of backups exist, the oldest one will be deleted automatically.
  • EMAIL_SERVER and EMAIL_SERVER_PORT  – The address and port of the email server you want to send backup reports to. ghettoVCB uses netcat to directly speak the SMTP protocol to your email server and as a result authentication and SSL/TLS are not supported! If you don’t want email reports on backups, delete these configuration lines.
  • EMAIL_TO – The email address to send backup reports to. If you don’t want email reports on backups, delete this configuration lines.

For an explanation of all of the other values, have a look at the Configurations section of the ghettoVCB documentation.

  1. Save and quit.


Now that ghettoVCB is installed and configured, we can run a backup. Firstly, try backing up a single VM using the command /opt/ghettovcb/bin/ -g /opt/ghettovcb/ghettoVCB.conf -m VMNAME , replacing VMNAME  with the name of your VM. ghettoVCB will then start backing up this VM to your configured datastore directory by creating a snapshot and then cloning the VM’s disks. Once complete, ghettoVCB will remove the snapshot and return you to the console.

Review the output of ghettoVCB for any errors. If the backup was successful, you should see the line  ###### Final status: All VMs backed up OK! ######  in the output. Now, try backing up all of your VMs using the command /opt/ghettovcb/bin/ -g /opt/ghettovcb/ghettoVCB.conf -a . Again, monitor the output of ghettoVCB and make sure that the backup completes successfully.


Running backups on a manual schedule is no fun though, so instead it’s possible to run ghettoVCB automatically using a cron job.

  1. Using the text editor of your choice (e.g. vi ), edit /var/spool/cron/crontabs/root .
  2. Add a new line containing 0 1 * * * /opt/ghettovcb/bin/ -g /opt/ghettovcb/ghettoVCB.conf -l /tmp/ghettoVCB.log -a > /dev/null .
  3. Save and quit – as this file is typically read-only you may need to force your editor to save (in vi , use the command :wq! ).

What does this new line do?

    • At 1am every day, executes the backup command. You can change the time that the backup command is executed by changing the cron expression from 0 1 * * * . If you’re unfamiliar with cron-syntax, you can use a tool such as Cron Maker to generate a suitable cron-syntax.
    • Uses the configuration file /opt/ghettovcb/ghettoVCB.conf to adjust how the backup runs.
    • Outputs a log of the backup process to /tmp/ghettoVCB.log , which can be viewed later.
    • Includes all VMs on the host as a backup target. If you only want to backup a specific VM, you can change -a to -m VMNAME . To backup a list of VMs, change -a to -f /opt/ghettoVCB/vmlist and edit /opt/ghettoVCB/vmlist so that it contains a list of the VM names you wish to backup, one per line.
    • Redirects the output of the script to /dev/null , as some issues have been reported with running ghettoVCB with a cron job when the output isn’t redirected.


After following the instructions above, ghettoVCB should be installed, configured and ready to backup your VMs automatically! Although ghettoVCB can store the VMs in any datastore, I would highly recommend backing them up to a remote datastore or having a separate task that copies the backups from a local datastore to a remote location. If you only backup locally and don’t transfer the backups elsewhere, you’re at risk of losing both your VM and its backup in a disaster recovery scenario.

If you get stuck, look at ghettoVCB’s output – it’ll often have useful information as to why a backup has failed. ghettoVCB’s documentation can also be a good resource for finding out more about it.

You may also like...

7 Responses

  1. im0 says:

    Thanks for the very helpful tutorial! The configuration step was a little different for me. I had to first download the default config file and copy it over to the ESXi host. Also you give its path as /opt/ghettoVCB/ghettoVCB.conf but the foldername is not consistent, it should read /opt/ghettovcb/ghettoVCB.conf, which is also used in the remainder of your tutorial. Cheers!

  2. Martin says:

    Thanks, you helped me a lot.

    I would just add that rebooting Esxi the Crontab is overwritten. I added the commands to /etc/rc.local.d/ that kill the cron, append the line to the crontab and start the cron deamon. In my case the was not editable even with the write permissions and I copied the file, edited and replaced the original. At the end I run “” to make the persistant through reboots.

  3. KingJ says:

    Good catch, thank you! I’ve updated the post – glad you found it helpful!

  4. Justin says:

    Great tutorial! works great on my free ESXI 6.7 to another iSCSI instant that I can easily failover,

  5. CNT4 says:

    Actually as of the date of my posting the correct location for the ghettoVCB.conf file is /etc/ghettovcb/ NOT /opt/ghettovcb/ghettoVCB.conf. I kept getting the following error:
    ERROR: “/opt/ghettovcb/ghettoVCB.conf” is not valid global configuration file!
    Your instructions keep saying that the correct ghettoVCB.conf file is locateted under /opt/, however the current version of the shell script located under /opt/ghettovcb/bin/ is looking for the ghettoVCB.conf to be in /etc/ghettovcb/

  6. Bjorn says:

    Since the crontab settings weren’t persisting after reboot, I added them to /etc/rs.local.d/ using this guide:
    and then ran /sbin/ to save them

  7. Nguyen Truong Quyen says:

    Hi all,

    could you tell me how to send the backup log to multi recipients, at the line: EMAIL_TO= in the ghettoVCB.conf I’ve tried to add many ways:
    1. (with a blank space between user1 and user2 email)
    With (1) sometimes it can work but when I add 1 more user it stop, right now it doesn’t work even thought 2 mails.


Leave a Reply

Your email address will not be published. Required fields are marked *