Using ghettoVCB.sh to backup ESXi 4.1 VMs to NFS Datastore

August 27, 2010
Tags: , ,

Introduction
I recently created an NFS datastore on ESXi, linked to a Windows Services for Unix (WSFU) share on my backup, Windows XP machine. The purpose of the datastore was to store virtual machine backups. The next step in the process is to configure ghettoVCB to perform the VM backups.

ghettoVCB
Details of ghettoVCB can be found on the VMware site. Download the zip file from that page.

In VSphere, browse datastore1.  Upload the zip file to that datastore (through VSphere client), connect to the Tech Support mode via PuTTY, and extract the contents of the tarball. The process is as follows:

  1. Start up Veeam Backup and FastSCP, then select Tools -> PuTTY.
  2. Log on with the user and password.
  3. Type ‘cd vmfs‘.
  4. Type ‘cd volumes‘.
  5. Type ‘cd datastore1‘.
  6. Type ‘tar -zxvf ghettoVCB.tar.gz‘.
  7. Type ‘cd ghettoVCB‘.

I created a list of virtual machines to backup.  The list was just one VM to begin with, Ubuntu 10.04. I called the list ‘myvmdk.vmdk’.

  1. Type ‘vi myvmdk.vmdk‘.
  2. Type each virtual machine name, one per line, that you will want backed up.
  3. When complete, hit Escape, then type ‘:WQ’ to save the new file.
  4. Type ‘chmod 777 ghettoVCB.sh‘ to set the permissions.

You’ll need to edit the ghettoVCB.sh file for your individual installation.  Most of the lines you can leave the as-is but there are a few near the top that will need changed.  They are fairly self-explanatory.  You’ll be able to see my configuration settings in the screen shot in the next section.

Run the backup manually
I then tested my setup by typing ‘./ghettoVCB.sh -f myvmdk.vmdk -d debug‘.  Depending upon how large your virtual machine is, the job could take a little while to run.  Fortunately the progress is shown at the bottom of the screen.  Once the job has completed, it will look like the following screen shot.

ghettoVCB backup

Automating the backup job
You’ll need Plink.exe on the Windows machine. You can get it from here. I downloaded it, and moved it to C:\.

Now you can create a simple batch (.BAT) file with your backup command in it, that can be scheduled via the Windows scheduler.  Open Notepad.  Type ‘C:\plink.exe root@<ip_address_of_ESXi_host> -pw <password> "/vmfs/volumes/datastore1/ghettoVCB/ghettoVCB.sh -f /vmfs/volumes/datastore1/ghettoVCB/myvmdk.vmdk -d debug“‘, replacing <…> with your information.  Save the file on the Windows machine with a .BAT suffix.

Before you schedule the task, you’ll need to take care of a housekeeping issue.  Highlight the command and paste it into a command window on the Windows box.  You will likely receive a message the first time saying the server’s host key is not cached in the registry.  Go ahead and answer ‘y’es to storing the key in the cache.

Now you can set the task to run as a scheduled task in Windows, just as you would any other task.  I set mine to run once a week in the middle of the night.

I noticed that, despite me setting the parameter for the backup to be thin provisioned, the backups were still full-size.  This will get researched in the near future but right now this serves my immediate need.


8 Responses to “Using ghettoVCB.sh to backup ESXi 4.1 VMs to NFS Datastore”

  1. Thanks a lot, this is incredibly helpful! Worked like a charm.

  2. Great, makes ESXI Backups fast and reliable. Thumbs up!

  3. What do you mean by you created a list of vms?

    Where did you store the list and how did you creat it.

    Mike

  4. Mike,
    I created it on the ESXi server, on Datastore1. Check out the four steps following “I called the list ‘myvmdk.vmdk’.”

  5. Hi,

    I’m having problems with the automation of plink.exe using a batch file on esxi 5.0. I’m getting keyboard-interactive authentication. If I manually enter the password, the backup works perfectly. Dpes anyone have a workaround so the password doesnt have to be manually entered? Using the -pw swtich doesnt seem to help.

  6. vmfs/volumes/4c56e862-f0fd7542-fd2a-002219258824/Backup # ./ghettoVCB.sh -f machines
    Logging output to “/tmp/ghettoVCB-2012-06-06_14-23-05.log” …
    2012-06-06 14:23:05 — info: ============================== ghettoVCB LOG START ==============================

    2012-06-06 14:23:05 — info: CONFIG – VERSION = 2011_06_28_1
    2012-06-06 14:23:05 — info: CONFIG – GHETTOVCB_PID = 118780927
    2012-06-06 14:23:05 — info: CONFIG – VM_BACKUP_VOLUME = /vmfs/volumes/datastore2
    2012-06-06 14:23:05 — info: CONFIG – VM_BACKUP_ROTATION_COUNT = 2
    2012-06-06 14:23:05 — info: CONFIG – VM_BACKUP_DIR_NAMING_CONVENTION = 2012-06-06_14-23-05
    2012-06-06 14:23:05 — info: CONFIG – DISK_BACKUP_FORMAT = thin
    2012-06-06 14:23:05 — info: CONFIG – ADAPTER_FORMAT = buslogic
    2012-06-06 14:23:05 — info: CONFIG – POWER_VM_DOWN_BEFORE_BACKUP = 0
    2012-06-06 14:23:05 — info: CONFIG – ENABLE_HARD_POWER_OFF = 0
    2012-06-06 14:23:05 — info: CONFIG – ITER_TO_WAIT_SHUTDOWN = 3
    2012-06-06 14:23:05 — info: CONFIG – POWER_DOWN_TIMEOUT = 5
    2012-06-06 14:23:05 — info: CONFIG – SNAPSHOT_TIMEOUT = 15
    2012-06-06 14:23:05 — info: CONFIG – LOG_LEVEL = info
    2012-06-06 14:23:05 — info: CONFIG – BACKUP_LOG_OUTPUT = /tmp/ghettoVCB-2012-06-06_14-23-05.log
    2012-06-06 14:23:05 — info: CONFIG – VM_SNAPSHOT_MEMORY = 0
    2012-06-06 14:23:05 — info: CONFIG – VM_SNAPSHOT_QUIESCE = 0
    2012-06-06 14:23:05 — info: CONFIG – VMDK_FILES_TO_BACKUP = all
    2012-06-06 14:23:05 — info: CONFIG – EMAIL_LOG = 0
    2012-06-06 14:23:05 — info:
    2012-06-06 14:23:14 — info: Snapshot found for AISAweb, backup will not take place

    2012-06-06 14:23:14 — info: ###### Final status: ERROR: All VMs failed! ######

    2012-06-06 14:23:14 — info: ============================== ghettoVCB LOG END ================================

    error please!!!

  7. You have an open snapshot on the vm AISAweb. You will need to delete it (which will merge it into the base) before running your backup script.

  8. Great post!

    Here a nice article on how to use #ghettoVCB in Spanish:

    http://www.sysadmit.com/2017/01/vmware-esxi-backup-gratuito-ghettovcb.html

Leave a Reply