Home VM Backup How to Easily Backup ESXi VM with GhettoVCB Scripts?

How to Easily Backup ESXi VM with GhettoVCB Scripts?

2023-09-12 | Nick Zhao

Table of contents
  • What is ghettoVCB.sh?
  • Pre-configuration
  • Installing ghettoVCB
  • How to backup ESXi VM with ghettoVCB.sh?
  • Debugging and test
  • How to backup VMware ESXi with enterprise backup solution?
  • Sum Up
Are you looking for a robust VM backup solution? Try Vinchin Backup & Recovery!↘ Download Free Trial

VMware vSphere is widely adopted by enterprises to deploy virtual environments. However, to protect the virtual environments, a backup solution is needed to guarantee business continuity. For example, IT administrators can use the free backup script to backup ESXi VMs.

What is ghettoVCB.sh?

The "ghettoVCB.sh" script is primarily designed for backup and restore purposes in VMWare ESXi 3.x, 4.x, 5.x, 6.x, 7.x & 8.x. It is similar to VMware's VCB (VMware Consolidated Backup) tool for performing backups. The workflow of ghettoVCB.sh involves taking a snapshot of the virtual machine, performing the backup, and then deleting the snapshot once the backup is completed. The script's notable feature is its ability to perform backups while the virtual machine is online, without the need for a shutdown.

Of course, except for ghettoVCB, you can also use PowerShell script to backup ESXi VMs.

As a simple backup solution for ESXi VM, ghettoVCB can only create full backup every time, so if you would like to backup only the delta data or in other words, create incremental backup or differential backup, you need other backup solutions like Vinchin Backup & Recovery.

Pre-configuration

You need to enable SSH on the ESXi host in vCenter and upload ghettoVCB to the ESXi server.

1. Enable SSH:

   1) Login to vCenter

   2) Select the ESXi host

   3) Select Configure on the right

   4) Expand System

   5) Select Services

   6) Select SSH

   7) Click START to enable SSH on the host

Enable SSH on ESXi host

2. Upload ghettoVCB:

   1) Download ghettoVCB from GitHub

   2) Login to vCenter

   3) Select the ESXi host

   4) Select Datastores on the right

   5) Select a datastore

   6) Click UPLOAD FILES to upload the zipped folder

Installing ghettoVCB

Since you have done the preparations, just untar the folder

1. Connect to the ESXi host using an SSH client

2. Navigate to the datastore where you uploaded the ghettoVCB files.

cd /vmfs/volumes/datastore_name

3. Extract the ghettoVCB archive

tar -zxvf ghettoVCB-archive.tar.gz

How to backup ESXi VM with ghettoVCB.sh?

Usage Example:

./ghettoVCB.sh -f [VM_BACKUP_UP_LIST] -c [VM_CONFIG_DIR] -l [LOG_FILE] -d [DEBUG_LEVEL] -g [GLOBAL_CONF] -e [VM_EXCLUSION_LIST]

OPTIONS:

-a   Backup all VMs on the host

-f    List of VMs to backup  

-c    VM configuration directory for VM backups

-g    Path to global ghettoVCB configuration file

-l     File to output logging

-d    Debug level [info|debug|dryrun] (default: info)

There are some common commands for different backup plans:

Backup VMs stored in a list:

./ghettoVCB.sh -f vms_to_backup

Backup all VMs residing on this host:

./ghettoVCB.sh -a

Backup all VMs residing on this host except for the VMs in the exclusion list:

./ghettoVCB.sh -a -e vm_exclusion_list

Backup VMs based on specific configurations located in the directory:

./ghettoVCB.sh -f vms_to_backup -c vm_backup_configs

Backup VMs using the global ghettoVCB configuration file:

./ghettoVCB.sh -f vms_to_backup -g /global/ghettoVCB.conf

The output will log to /tmp/ghettoVCB.log (consider logging to local or remote datastore to persist logs)

./ghettoVCB.sh -f vms_to_backup -l /vmfs/volume/local-storage/ghettoVCB.log

Dry run (no backup will take place):

./ghettoVCB.sh -f vms_to_backup -d dryrun

After you make a VM backup with ghettovcb.sh, you can use ghettovcb-restore.sh to restore the ESXi VM when needed.

Debugging and test

After understanding the relevant parameters and settings, let's implement a simple example.

1. Establish a list for VM

~ # vi vms_to_backup
# Add the VM names

2. Debugging

It is quite useful for troubleshooting.

~ # ./ghettoVCB.sh -f vms_to_backup -d debug

3. Dry run testing

The main purpose is to test the backup first to see if there are any issues. Dryrun mode will not generate backup files.

~ # ./ghettoVCB.sh -f vms_to_backup -d dryrun

How to backup VMware ESXi with enterprise backup solution?

GhettoVCB is a convenient solution for ESXi backup but it lacks integrated protection to enterprises’ production environments.

Vinchin Backup & Recovery is a professional ESXi backup solution for enterprises. IT administrators can quickly deploy the backup system by deploying CentOS on a VM or physical machine. Then the backup system can be reached via a user-friendly web console and many backup strategies can be used.

What’s more Vinchin Backup & Recovery also supports VM backup for other virtualization platforms like Hyper-V, XenServer, XCP-ng, oVirt, RHV, OpenStack, etc.; to help manage the multi-hypervisor environment, it can also help implement easy V2V migration by restoring VM backup on another host; instant Recovery can shorten the RTO by starting a failed VM from its backup in 15 seconds.

To backup ESXi VMs with Vinchin Backup & Recovery:

1. Select the ESXi VMs

Select ESXi VMs

2. Select the storage to store the VM backup

Select Backup Destination

3. Select backup strategies like schedules, incremental backup, encrypted transmission, retention policy, etc.

Select Backup Strategies

4. Submit the job

Submit the backup Job

Vinchin Backup & Recovery has been selected by thousands of companies and you can also start a 60-day full-featured free trial here. Also, contact us, leave your requirements, and then you will receive your tailored solution. We have established partnerships with reputable companies all over the world so if you would like to do a local business, you can select a local partner here.

Sum Up

ESXi VMs need to be backed up in case of any disasters happening to the production environments. IT administrators can use the free backup scripts ghettoVCB to simply backup ESXi VM.

If the ghettoVCB.sh cannot provide enough protection to your virtual environment, you can turn to Vinchin Backup & Recovery to backup the ESXi VMs professionally. Don’t miss the free trial.

Share on:

Categories: VM Backup
You May Also Like...