ghettoVCB performs backups of virtual machines residing on VMware vSphere ESX(i) 3.5/4.x/5.x servers using methodology similar to VMware's VCB tool. The script takes snapshots of live running virtual machines, backs up the master VMDK(s) and then upon completion, deletes the snapshot until the next backup. The only caveat is that it utilizes resources available to the Service Console of an ESX server or the Busybox Console (ESXi Shell) of the ESXi server running the backups as opposed to following the traditional method of offloading virtual machine backups through a VCB proxy.
This script has been tested on ESX 3.5/4.x/5.x and ESXi 3.5/4.x/5.x and supports the following backup mediums: LOCAL STORAGE, SAN and NFS. The script is non-interactive and can be setup to run via cron. Currently, this script accepts a text file that lists the display names of virtual machine(s) that are to be backed up. Additionally, one can specify a folder containing configuration files on a per VM basis for granular control over backup policies.
Additionally, for ESX(i) environments that don't have persistent NFS datastores designated for backups, the script offers the ability to automatically connect the ESX(i) server to a NFS exported folder and then upon backup completion, disconnect it from the ESX(i) server. The connection is established by creating an NFS datastore link which enables monolithic (or thick) VMDK backups as opposed to using the usual nix mount command which necessitates breaking VMDK files into the 2gbsparse format for backup. Enabling this mode is self-explanatory and will evidently be so when editing the script (Note: **VM_BACKUP_VOLUME* variable is ignored if ENABLE_NON_PERSISTENT_NFS=1 ).
In its current configuration, the script will allow up to 3 unique backups of the Virtual Machine before it will overwrite the previous backups; this however, can be modified to fit procedures if need be. Please be diligent in running the script in a test or staging environment before using it on production live Virtual Machines; this script functions well within our environment but there is a chance that it may not fit well into other environments.
If you have any questions, you may post in the dedicated ghettoVCB VMTN community group.
If you have found this script to be useful and would like to contribute back, please click here to donate.
1) Download ghettoVCB from github by clicking on the ZIP button at the top and upload to either your ESX or ESXi system (use scp or WinSCP to transfer the file)
2) Extract the contents of the zip file (filename will vary):
# unzip ghettoVCB-master.zip Archive: ghettoVCB-master.zip creating: ghettoVCB-master/ inflating: ghettoVCB-master/README inflating: ghettoVCB-master/ghettoVCB-restore.sh inflating: ghettoVCB-master/ghettoVCB-restore_vm_restore_configuration_template inflating: ghettoVCB-master/ghettoVCB-vm_backup_configuration_template inflating: ghettoVCB-master/ghettoVCB.conf inflating: ghettoVCB-master/ghettoVCB.sh
3) The scripts should be located inside the directory named ghettoVCB-master
# ls -l -rw-r--r-- 1 root root 281 Jan 6 03:58 README -rw-r--r-- 1 root root 16024 Jan 6 03:58 ghettoVCB-restore.sh -rw-r--r-- 1 root root 309 Jan 6 03:58 ghettoVCB-restore_vm_restore_configuration_template -rw-r--r-- 1 root root 356 Jan 6 03:58 ghettoVCB-vm_backup_configuration_template -rw-r--r-- 1 root root 631 Jan 6 03:58 ghettoVCB.conf -rw-r--r-- 1 root root 49375 Jan 6 03:58 ghettoVCB.sh
4) Before using the scripts, you will need to enable the execute permission on both ghettoVCB.sh and ghettoVCB-restore.sh by running the following:
chmod +x ghettoVCB.sh chmod +x ghettoVCB-restore.sh