ghettoVCB

This post was most recently updated on December 11th, 2018

1. First of all, download the ghettoVCB.sh script, and the example file vmbackup

2. Now, you’ll need to ftp these files to you ESXi host (If you haven’t already enabled ftp access, you can find my guide on how to do it here http://www.rancidswan.com/?p=4)

3. Now, ssh to your ESXi host and edit the ghettoVCB.sh file. There are a number of options at the top of the file, but not many, and they should all be fairly self explanatory. Just for testing you can set the path of the backup location to be somewhere on the ESXi host itself. Later I’ll be writing a guide on how to setup an NFS share on a Windows 2003 server so that these snapshot backups can be pushed directly to a windows machine.

4. You’ll also need to edit the file I’ve called vmbackup. This file purely contains just the name of the machine you want to backup (note: it’s the machine’s Virtual Machine name, not it’s Computer name you use, the name has to be understandable by the ESXi host)  You can have multiple machine names if you wish, with distinct names on each line, but personally I’d recommend just having one name in the file, this will make it easier to automate individual machine backups later on)

5. OK, now you’ll need to set the permissions on the file ghettoVCB.sh like this:

chmod 777 ghettoVCB.sh

5. Now, to run the script, you simply need to write:

./ghettoVCB.sh vmbackups

The script will now run and either show a progress meter, or show you any error messages you might need to tackle!

 

Implement the script

After logging in via SSH, we need to download GhettoVCB.sh
~ # mkdir backup

~ # cd backup

/backup # wget http://dakeung.com/wp-content/uploads/2009/09/GhettoVCB.sh

Connecting to dakeung.com (174.120.63.119:80)
GhettoVCB.sh 100% |****************************************| 17974 00:00:00 ETA
/backup # chmod +x GhettoVCB.sh

* you upload the file from inside “Browse Storage” in vSphere Client.

ADD NFS SERVER AS DATASTORE

We now need to add the NFS server to the vSphere Client.

add_NFS_storage

add_NFS_storage

CONFIGURING GHETTOVCB.SH

Back to SSH :

/backup # ls /vmfs/volumes/

Locate your NFS mount point, remember the path for your NFS server as you will need it in the next step.

/backup # vi GhettoVCB.sh

Modify :

# directory that all VM backups should go (e.g. /vmfs/volumes/SAN_LUN1/mybackupdir)

VM_BACKUP_VOLUME=/vmfs/volumes/BACKUP-STORAGE

To point to your NFS backup mount.

# enable compression with gzip+tar 1=on, 0=off
ENABLE_COMPRESSION=1

This will compress the images before transferring them, if you want to maintain your files without compression. Change this to =0

Save

Now to list the virtual machines to backup:

/backup # touch vmserver.list

/backup # vi vmserver.list

Add the names of your virtual machines here.

Save

Run Backup:

/backup # ./GhettoVCB.sh vmserver.list

That should start the vm backups.

Scheduling Backups:

If you would want to run cronjobs, please check out the following site.

http://communities.vmware.com/docs/DOC-8760

Alternately you can run the backups from Windows using PLINK

Related Post