Skip to content

About

Homelab

Which NUC should I buy?

Intel NUC Model Lineup

BIOS Settings for Intel NUC

NUC Latest BIOS Versions

ASRock Industrial 11th Gen NUC

11th Gen NUC Pro (Tiger Canyon)

11th Gen NUC (Panther Canyon)

10th Gen NUC (Frost Canyon)

8th Gen NUC (Bean Canyon)

8th Gen NUC (Hades Canyon)

7th Gen NUC (Commercial)

7th Gen Intel NUC

Skull Canyon Intel NUC

6th Gen Intel NUC

5th Gen Intel NUC

VMware

Study Guides

VCP6-DCV Delta

VCAP5-DCA

VCAP5-DCD

vSphere Version Compared

vSphere 5.1 vs. 5.5

vSphere 5.5 vs. 6.0

vSphere 6.0 vs. 6.5

vSphere 6.5 vs. 6.7

vSphere 6.7 vs. 7.0

vSphere 7.0 vs. 8.0

ESXi Releases

ESX Releases

vCenter Releases

Workstation Releases

Product Latest Version

VM Hardware Versions

ESXi Image Profiles

Configuration Maximums

PowerCLI Snippets

Acronyms / Abbreviations

ESXTOP Guide

vSphere 6.5

vSphere 6.7

vSphere 7.0

ESXi on Raspberry Pi

NSX

NSX Glossary

NSX-T Releases

NSX-T Build Matrix

NSX-V Releases

NSX-V Build Matrix

NSX-V Communication Diagram

30 Minutes NSX-V Deployment

NSX-V in Homelabs

NSX-V Log Insight Integration

NSX-V 6 Resource Calculator

vSAN

vSAN 6.6 RVC Guide

vSAN 5.5 RVC Guide

Single-Node vSAN

vSAN Intel NUC Cluster

K8S

Troubleshooting

Tools

SCSI Sense Code Decoder

SCSI Sense Code Decoder v2

vTracker

vTracker Table

PowerShell OVF Helper

End Of Support Countdown

Product Interop Lister

Product Interop Diff

HCL Diff Tool

vscsiStats Grapher

vCenter Events

vTranslate

OUI Vendor Lookup

JSON Repository

Navigation Menu

Navigation Menu

About

Homelab

Which NUC should I buy?

Intel NUC Model Lineup

BIOS Settings for Intel NUC

NUC Latest BIOS Versions

ASRock Industrial 11th Gen NUC

11th Gen NUC Pro (Tiger Canyon)

11th Gen NUC (Panther Canyon)

10th Gen NUC (Frost Canyon)

8th Gen NUC (Bean Canyon)

8th Gen NUC (Hades Canyon)

7th Gen NUC (Commercial)

7th Gen Intel NUC

Skull Canyon Intel NUC

6th Gen Intel NUC

5th Gen Intel NUC

VMware

Study Guides

VCP6-DCV Delta

VCAP5-DCA

VCAP5-DCD

vSphere Version Compared

vSphere 5.1 vs. 5.5

vSphere 5.5 vs. 6.0

vSphere 6.0 vs. 6.5

vSphere 6.5 vs. 6.7

vSphere 6.7 vs. 7.0

vSphere 7.0 vs. 8.0

ESXi Releases

ESX Releases

vCenter Releases

Workstation Releases

Product Latest Version

VM Hardware Versions

ESXi Image Profiles

Configuration Maximums

PowerCLI Snippets

Acronyms / Abbreviations

ESXTOP Guide

vSphere 6.5

vSphere 6.7

vSphere 7.0

ESXi on Raspberry Pi

NSX

NSX Glossary

NSX-T Releases

NSX-T Build Matrix

NSX-V Releases

NSX-V Build Matrix

NSX-V Communication Diagram

30 Minutes NSX-V Deployment

NSX-V in Homelabs

NSX-V Log Insight Integration

NSX-V 6 Resource Calculator

vSAN

vSAN 6.6 RVC Guide

vSAN 5.5 RVC Guide

Single-Node vSAN

vSAN Intel NUC Cluster

K8S

Troubleshooting

Tools

SCSI Sense Code Decoder

SCSI Sense Code Decoder v2

vTracker

vTracker Table

PowerShell OVF Helper

End Of Support Countdown

Product Interop Lister

Product Interop Diff

HCL Diff Tool

vscsiStats Grapher

vCenter Events

vTranslate

OUI Vendor Lookup

JSON Repository

Backup vSphere Cluster with ghettoVCB

by Florian Grehl

February 15, 2020

5 Comments

The ghettoVCB script is a well known free backup solution for standalone ESXi Hosts created by William Lam. The script works with ESXi 3.x up to ESXi 6.7. It does not support vCenter or cluster backups out of the box but with a little workaround, you can backup virtual machines in a DRS enabled cluster. I'm using this type of backup for a couple of months without issues.

ghettoVCB Repository

ghettoVCB Documentation

ghettoVCB Restore Documentation

Download and prepare the ghettoVCB script. Instead of using the vib package, I'm just placing the script into my backup datastore, which is already mounted to all ESXi hosts. This allows me to configure and change everything in a central place.

SSH to the first ESXi host and run the following commands:

# cd /vmfs/volumes/backupDatastore
# mkdir ghettoVCB
# cd ghettoVCB/
# mkdir logs
# mkdir backups
# wget https://github.com/lamw/ghettoVCB/archive/master.zip
# unzip master.zip

The directory structure should look like this:

The ghettoVCB Script needs two configurations, the main config (ghettoVCB.conf) and a list of virtual machines to be included in the backup (vmlist.conf). Configuration files are located in the ghettoVCB-master directory. Configure both files to match your environment:

ghettoVCB.conf

In my configuration, I've only changed VM_BACKUP_VOLUME and VM_BACKUP_ROTATION_COUNT. For more information about configuration options, check the official documentation.

VM_BACKUP_VOLUME=/vmfs/volumes/backupDatastore/ghettoVCB/backups
DISK_BACKUP_FORMAT=thin
VM_BACKUP_ROTATION_COUNT=2
POWER_VM_DOWN_BEFORE_BACKUP=0
ENABLE_HARD_POWER_OFF=0
ITER_TO_WAIT_SHUTDOWN=3
POWER_DOWN_TIMEOUT=5
ENABLE_COMPRESSION=0
VM_SNAPSHOT_MEMORY=0
VM_SNAPSHOT_QUIESCE=0
ALLOW_VMS_WITH_SNAPSHOTS_TO_BE_BACKEDUP=0
ENABLE_NON_PERSISTENT_NFS=0
UNMOUNT_NFS=0
NFS_SERVER=
NFS_VERSION=nfs
NFS_MOUNT=/nfsshare
NFS_LOCAL_NAME=nfs_storage_backup
NFS_VM_BACKUP_DIR=mybackups
SNAPSHOT_TIMEOUT=15
EMAIL_ALERT=0
EMAIL_LOG=0
EMAIL_SERVER=0
EMAIL_SERVER_PORT=25
EMAIL_DELAY_INTERVAL=1
EMAIL_USER_NAME=
EMAIL_USER_PASSWORD=
EMAIL_TO=0
EMAIL_ERRORS_TO=
EMAIL_FROM=0
WORKDIR_DEBUG=0
VM_SHUTDOWN_ORDER=
VM_STARTUP_ORDER=

vmlist.conf

A plain list of virtual machine display names to be included in the backup.

vc.virten.lab
nsx-mgt.virten.lab
db01.virten.lab

Verify that the configuration is working by running a manual backup:

# /vmfs/volumes/backupDatastore/ghettoVCB/ghettoVCB-master/ghettoVCB.sh -f /vmfs/volumes/backupDatastore/ghettoVCB/ghettoVCB-master/vmlist.conf -g /vmfs/volumes/backupDatastore/ghettoVCB/ghettoVCB-master/ghettoVCB.conf

Please keep in mind that ghettoVCB can only backup virtual machines that are running on the ESXi host where the script has been started. The following error message is displayed when VMs are running on another ESXi host:

info: ERROR: failed to locate and extract VM_ID for db01.virten.lab!

A successful backup should look like this:

info: Initiate backup for vc.virten.lab

info: Creating Snapshot "ghettoVCB-snapshot-2020-02-08" for vc.virten.lab

Option --adaptertype is deprecated and hence will be ignored

Destination disk format: VMFS thin-provisioned

Cloning disk '/vmfs/volumes/ds2/vc.virten.lab/vc.virten.lab.vmdk'...

Clone: 100% done.

info: Removing snapshot from vc.virten.lab ...

info: Slept 1 seconds to work around NFS I/O error

info: Backup Duration: 37 Seconds

info: Successfully completed backup for vc.virten.lab!

At this point, you should be able to run manual backups from each ESXi in the cluster. The next step is to create a cronjob at an external Linux server to start the backup on all ESXi hosts one by one automatically.

SSH to your Linux machine. In this example, I'm using a Debian 10.

Create a user that runs the ghettoVCB Script.
# adduser ghettoVCB

Become the ghettoVCB user.
# su - ghettovcb

Create an ssh key. Make sure that you do not set a passphrase.
# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/ghettovcb/.ssh/id_rsa):
Created directory '/home/ghettovcb/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/ghettovcb/.ssh/id_rsa.
Your public key has been saved in /home/ghettovcb/.ssh/id_rsa.pub.

Copy the public key.
# cat .ssh/id_rsa.pub

ssh-rsa AAAAB3NzaC[...]1yc2EAAAADA ghettovcb

SSH to each ESXi Host and add the public key to root users authorized_keys.
# echo "ssh-rsa AAAAB3NzaC[...]1yc2EAAAADA ghettovcb" >> /etc/ssh/keys-root/authorized_keys

Back to your Linux host, verify that it can connect to ESXi Hosts without a password. This step is mandatory for all ESXi hosts as you have to accept each host's fingerprint manually once.
# ssh [email-masked] 'hostname'
The authenticity of host 'esx1.virten.lab' can't be established.
ECDSA key fingerprint is SHA256:7nJ[...]
Are you sure you want to continue connecting (yes/no)? yes
# ssh [email-masked] 'hostname'
The authenticity of host 'esx2.virten.lab' can't be established.
ECDSA key fingerprint is SHA256:DmC[...]
Are you sure you want to continue connecting (yes/no)? yes

Create a script (remoteGhettoVCB.sh) with the following content. Make sure to configure datastore path and ESXi hostnames to match your environment:
#!/bin/bash

GHETTOPATH=/vmfs/volumes/backupDatastore/ghettoVCB/ghettoVCB-master
GHETTOLOGDIR=/vmfs/volumes/backupDatastore/ghettoVCB/logs

for i in esx1.virten.lab esx2.virten.lab esx3.virten.lab
do
echo Starting Backup on Host $i
/usr/bin/ssh root@$i "$GHETTOPATH/ghettoVCB.sh -f $GHETTOPATH/vmlist.conf -g $GHETTOPATH/ghettoVCB.conf -l $GHETTOLOGDIR/$i-$(date +%Y-%m-%d-%H%M).log"
done

Make the script executable
# chmod +x remoteGhettoVCB.sh

Create a cronjob that runs the backup job daily at 2:30 AM (or whenever you want to start the backup):
# crontab -e

30 2 * * * /home/ghettovcb/remoteGhettoVCB.sh >> /var/log/ghettovcb.log

That's it. You can run the remoteGhettoVCB.sh script once to verify that it runs successfully.

To verify that backups are created without errors, check the /var/log/ghettovcb.log file on the Linux machine, or individual backup job logs at /vmfs/volumes/backupDatastore/ghettoVCB/logs/

Share:

LinkedIn

Twitter

WhatsApp

Facebook

Reddit

Related posts:

Clone ESXi Installations on SD Cards or USB Flash Drives

Manage VSAN 5.5 with RVC Part 2 – VSAN Cluster Administration

First Look: Veeam Backup & Replication 6.1

Backup Solutions for Free ESXi

NAKIVO Backup & Replication 6 Review

Tags:BackupghettoVCBHomelab

5 thoughts on “Backup vSphere Cluster with ghettoVCB”

Anonymous

May 27, 2020 at 10:31 pm

Does ghettoVCB work already with ESXi 7.0?

Reply

fgrehl

May 28, 2020 at 7:52 am

Yes.

Reply

Anonymous

June 1, 2020 at 11:31 am

Hi,

Does ghettoVCB have capability to skip RDM automatically?

Reply

allgood

March 20, 2021 at 1:52 pm

Good stuff, for "anonymous"dont use esxi 7.0.Good that you explaind GhettoVCB because afte i installed the .vib, I could not modify the .sh.

Had to move it like you describe to another location, then customize, then chmod, then i could run it.

Reply

Bender

April 6, 2023 at 4:21 pm

Does this script with ESXi 8.0? Thanks in advance.

Reply

Leave a Reply Cancel reply

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

Comment *

Name

Email

Website

Notify me of follow-up comments by email.

Notify me of new posts by email.

Search
Search

Popular Articles

ESXi on 12th Gen NUC Pro

ESXi Build Numbers

vCenter Build Numbers

SCSI Sense Code Decoder

vTracker

OVF Helper

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Email Address

Subscribe

Copyright © 2023 virten.net | Impressum / Privacy Policy

Neve | Powered by WordPress

This website uses cookies to give you the best online experience. By using our website you agree to our use of cookies. Accept

Privacy & Cookies Policy

Close

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the ...

Necessary

Necessary

Always Enabled

Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.

Non-necessary

Non-necessary

Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.

SAVE & ACCEPT