Site icon Information2 | Data Management & Recovery Pioneer

How to Use Ghettovcb to Backup VMware ESXi VMs Step-by-Step

What is Ghettovcb Backup?

GhettoVCB is a popular, free, open-source backup script designed by William Lam to create backups of VMware ESXi virtual machines.  It runs directly on ESXi Shell, requires no vCenter, and works with ESXi free edition. Ghettovcb.

It will create a snapshot of your VM, and use vmkstools to clone the VMDK(s) to the backup destination. After a successful copy, the snapshot will be automatically deleted.

► Key features and advantages of ESXi backup using Ghettovcb script:

► Limits of Ghettovcb:

► Best Use Cases:

GhettoVCB is particularly suitable for:

In the next section, we will walk you through the whole ghettovcb process, from installation and scripts. In addition, we will introduce a comprehensive backup solution that offers better backup strategy (such as incremental and differential backup)

How to Backup VMware ESXi VMs with GhettoVCB scripts

In this section, you will know how to install ghettoVCB and set up VMware ESXI VMs backups step by step.

Prerequisites:✎
SSH access to your ESXi host (enable via vSphere Client: Host → Services → SSH → Start).
A datastore with enough free space to store backups.
(Optional) An NFS or CIFS share for off‑host backups.

Part 1. Download

From the official GitHub repository: https://github.com/lamw/ghettoVCB to Download ghettoVCB.

Part 2. Install ghettoVCB

►Manual Installation (Script Upload)

1. SSH into your ESXi host as root.

2. Create a directory on a datastore (e.g., /vmfs/volumes/datastore1/scripts):

mkdir -p /vmfs/volumes/datastore1/scripts

3. Upload ghettoVCB.sh to that directory using SCP or by copying from a USB.

4. Make it executable:

chmod +x /vmfs/volumes/datastore1/scripts/ghettoVCB.sh

5. Run a test:

cd /vmfs/volumes/datastore1/scripts
./ghettoVCB.sh -h
Note: If ESXi reboots, the script remains on the datastore, but you must manually execute it. For automatic cron jobs, the VIB method is better.

►VIB Installation

For ESXi 5.0 and above, the VIB package installs ghettoVCB persistently:

1. Download the offline bundle (VIB) from the GitHub releases.

2. Place it on a datastore or serve it via HTTP.

3. Install using ESXCLI:

esxcli software vib install -v /path/to/lamw-ghettoVCB.vib

4. After installation, the script is available at /opt/ghettoVCB/ghettoVCB.sh.

Part 3. Backup Configuration

ghettoVCB uses a global configuration file (default: /etc/ghettoVCB/ghettoVCB.conf). Below are the most important parameters to customize:

Parameter Description
VM_BACKUP_VOLUME Backup destination path
DISK_BACKUP_FORMAT thin, thick, eagerzeroedthick, rdm, etc.
VM_BACKUP_ROTATION_COUNT Number of backup copies kept per VM
EMAIL_LOG Send log via email (needs sendmail configured)
ENABLE_COMPRESSION Use compression (tar + pigz)
ENABLE_NON_PERSISTENT_NFS Mount NFS on‑the‑fly, unmount after backup
SNAPSHOT_TIMEOUT Timeout for snapshot creation (seconds)
POWER_VM_DOWN_BACKUP Power off VM before backup (use for special cases)
EMAIL_ALERTS Configure SMTP settings to receive backup success and failure logs.
EXCLUDE_DISKS Enable rules to skip independent non-persistent disks during backup.

For users backing up VMs to Unraid or external NAS, you will also need to configure persistent NFS mounts directly within the ESXi host to ensure the backup destination remains accessible after reboots.

Part 4. Scripts to run ghettoVCB backup

Once configured, you can run backup tasks directly from the ESXi SSH shell with simple, intuitive commands.

► Backup a Single VM

./ghettoVCB.sh -m "MyVM"

► Backup Multiple VMs from a List File

1. Create a list file (one VM name per line), e.g., /backup/vm_list.txt

2. Run the command:

./ghettoVCB.sh -f /backup/vm_list.txt

► Backup All Running VMs

./ghettoVCB.sh -a

Use a Custom Configuration File

./ghettoVCB.sh -c /path/to/my_backup.conf -m "MyVM"

► Exclude Specific VMs

Create an exclude list file and use -e:

./ghettoVCB.sh -a -e /backup/exclude_list.txt

► Validate Backup Configuration with Dry-Run Test

The Dry-Run test provides a quick summary of details on whether a given set VMs will be backed up. Before creating an actual backup, you can run the following command to validate:

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

► Debug Mode

If backups fail, always start with debug output:

./ghettoVCB.sh -d debug -m "MyVM"

Debug logs show exact vmkfstools commands and snapshot operations.

Backup Strategy Tips
Don’t store backups on the same datastore as production VMs. Use a separate local disk, NFS share or SAN LUN. NFS is ideal. Because ghettoVCB works great with NFS targets (like UnRAID, Synology, or FreeNAS). The ENABLE_NON_PERSISTENT_NFS option makes it easy. 
Perform 3-2-1 backup strategy. Keep at least 3 rotation copies for critical VMs. For large VMs (1TB+), consider reducing rotation to 1 or 2 if space is tight.
 Use thin format for backup to save space. Restoring as thin keeps the disk flexible. And Use thick only if you need guaranteed performance on restore. 
Keep your ESXi host and backup destination on separate VLANs if possible for security.

Part 6. Automate ghettoVCB Backup with Cron Scheduling

One of the most requested features for ghettoVCB backup is automated, scheduled backups. ESXi supports cron jobs to run backup scripts daily, weekly, or on custom schedules.

1. Edit the ESXi crontab for root:

vi /var/spool/cron/crontabs/root

2. Add a backup schedule. For example, backup all running VMs every day at 2 AM.

0 2 * * * /opt/ghettoVCB/ghettoVCB.sh -a -c /etc/ghettoVCB/ghettoVCB.conf

3. Make Cron persist Across Reboots

Add the following line to /etc/rc.local (or use the VIB’s built‑in persistence):

/bin/kill $(cat /var/run/crond.pid) 2>/dev/null
/usr/lib/vmware/busybox/bin/busybox crond

Better yet, install the ghettoVCB VIB – it includes a startup script that restores cron jobs.

4. Log Management: ghettoVCB writes logs to the backup destination by default. You can also set a global log file in the config:

LOG_DIR=/vmfs/volumes/datastore1/logs

To email logs, configure sendmail on ESXi (complex) or use a script that mails after cron.

Part 7. Restoring from ghettoVCB Backup 

ghettoVCB provides ghettoVCB-restore.sh. to restore ghettoVCB backup.

►Basic restore command:

./ghettoVCB-restore.sh -p /backup/path/MyVM

This command will:

►Manual Restore (Alternative)

If you prefer manual control:

1. Browse the backup directory. You’ll find a folder like MyVM-2025-03-15_02-00-01/ containing .vmdk and .vmx files.

2. Copy the .vmx and .vmdk files to your desired datastore using cp or mv.

3. Register the VM via vSphere Client: Create / Register VM → Register an existing virtual machine.

4. Power on and verify.

Note:
1. Network adapters may need reconfiguration (MAC address changes, IP settings).
2. If restoring to a different ESXi host, you may need to re‑acknowledge storage.
3. For thin‑to‑thick conversion, restore using vmkfstools -i manually.

GhettoVCB Common Issues & Troubleshooting

If you encounter a problem when perform ghettoVCB’s commands, there are common issues and solutions.

1. SSH / Permission Denied

Ensure you’re logging in as root and SSH is enabled. Some ESXi builds restrict root SSH – enable via DCUI or advanced settings.

2. Orphaned Snapshots After Backup

If ghettoVCB is interrupted, a snapshot may remain. Check with:

vim-cmd vmsvc/getallvms
vim-cmd vmsvc/snapshot.get <vmid>\

Remove it manually:

vim-cmd vmsvc/snapshot.removeall <vmid>

3. “Insufficient space” on Backup Volume

Solution: Increase VM_BACKUP_ROTATION_COUNT to keep fewer copies, or add more storage. Use du -sh /backup/* to see which VMs consume most space.

4. Backup Fails – “Failed to create snapshot”

    5. Backup Destination Not Writable

    For NFS shares, confirm they are mounted correctly:

    esxcli storage nfs list

    If using ENABLE_NON_PERSISTENT_NFS, verify credentials and path.

    6. Debug Mode Doesn’t Show Enough

    Set DEBUG_LOG=1 inside the script or run with -d debug. For even deeper vmkfstools logging, modify the script to add -v 10 to the vmkfstools cloning line (advanced users only).

    Alternative Backup Solution for Enterprise Environment

    ghettoVCB is a good solution for home labs, small deployments, and budget‑conscious environments. It has served the VMware community faithfully for over a decade. However, as your virtual environment grows from a handful of VMs to dozens or hundreds, you may require incremental backup, better backup and restore performance, and anti-ransomware protection.

    Here we would like to introduce an enterprise backup and recovery solution – i2Backup. It offers reliable, agentless, scalable, and secure data protection for VMware VMs across physical, virtual, and cloud environments. You can easily create backup schedules for all VMware VMs from one console without installing an agent on guest VMs.

    i2Backup and ghettoVCB comparison:

    Features

    ghettoVCB

    i2Backup

    Backup Types

    Full backup only

    Full, incremental, differential, incremental‑forever

    Management interface

    Command line (SSH + text files)

    Web‑based B/S graphical interface with centralized management

    Recovery scope

    Entire VM (full VMDK restore)

    VM restore + granular file‑level restore + single‑file recovery

    Backup deduplication

    None

    Advanced intelligent deduplication (variable‑block)

    Backup Security

    None

    AES-256 backup encryption, Immutable backup (ransomware protection), Role-based Access Control

    Storage destinations

    Local datastores, NFS

    Local disks, NAS, tape libraries, object storage, deduplicated storage, S3 cloud

    Backup rotation

    Simple rotation count

    Intelligent retention policies, customizable lifecycle governance

    You can click the download button below to get a 60-day free trial:

    FREE Trial for 60-Day

    Conclusion

    In this article, we provide the step-by-step ghettoVCB backup for VMware ESXi virtual machines. It is a great method for free ESXi users, home labs, and small businesses.

    However, ghettoVCB is not an enterprise backup solution with incremental forever, deduplication, and centralized management. If you need a professional and robust backup solution, Info2Soft’s i2Backup. Besides VMware, i2Backup also supports backing up Hyper-V, OpenStack, and other virtual machines.

    Exit mobile version