Backing up your Vsphere Virtual Machines host unfortunately is one of the last items you address when bringing your VMs online. With everything that goes into VMware Vsphere, back up seems to be an area where Vmware has fallen short.

Currently there is no built in method for performing a backup of your Vsphere Virtual Machines. In previous version of Vsphere,  VCB or Vmware Consolidated Backup was a viable option for backing up your Vms, but in newer version of Vsphere, VCB has been discarded in favor to VMware Data Protection. As is the case, this option is available for purchase. Other solutions are available, such as Net backup, Acronis and others, but like anything else they aren’t free…So what is a cash crunched admin to do..The answer is ghettoVCB.sh

This article will provide you the details of backing up your Vsphere Virtual Machines without breaking the bank. Now, as the case with most free options this solution does require you possess an intermediate level of understanding of Linux, VI and have SSH access to your Vsphere host.

GhettoVCB.sh script performs backups of virtual machines residing on 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.

Upon dowloading GhettoVCB.sh, you will want to create a folder on the root file system and copy it to this folder. Then it will be necessary to unzip the file

unzip ghettoVCB-master.zip

and make sure you have the appropriate rights and permissions:

chmod +x ghettoVCB.shchmod +x ghettoVCB-restore.sh

As is the case with open source solutions, it is now necessary to configure the solution for your environment. Below are list of the variables ,with sample values, that are necessary for GhettoVCB.sh to successfully backup your Vsphere Virtual machines. Several of the variables are pretty self explanatory & are within your scope of setting up. With that being said, please take the time to gather this data prior to configuring this solution, it will make this alot easier. Of the variables listed below if you have any issues it will most certainly come from these variables

EMAIL_LOG=0
EMAIL_SERVER=
EMAIL_SERVER_PORT=25
EMAIL_DELAY_INTERVAL=1
EMAIL_TO=
EMAIL_FROM=

But don’t sweat it, it wont be anything you and your Email admin cant figure out.
VM_BACKUP_VOLUME=Backup Location
DISK_BACKUP_FORMAT=thin
VM_BACKUP_ROTATION_COUNT=3
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=172.30.0.195
NFS_MOUNT=/nfsshare
NFS_LOCAL_NAME=nfs_storage_backup
NFS_VM_BACKUP_DIR=mybackups
SNAPSHOT_TIMEOUT=15
EMAIL_LOG=0
EMAIL_SERVER=auroa.primp-industries.com
EMAIL_SERVER_PORT=25
EMAIL_DELAY_INTERVAL=1
[email protected]
[email protected]
WORKDIR_DEBUG=0
VM_SHUTDOWN_ORDER=
VM_STARTUP_ORDER=

After you have addressed each variable, now it is time to give it a go. Like with so many solutions there are numerous switches to further define how the backup will run

OPTIONS:
-a Backup all VMs on host
-f List of VMs to backup
-m Name of VM to backup (overrides -f)
-c VM configuration directory for VM backups
-g Path to global ghettoVCB configuration file
-l File to output logging
-w ghettoVCB work directory (default: )
-d Debug level [info|debug|dryrun] (default: info)

I will make the assumption that you want to backup all your VMs on your host for this example.

./ghettoVCB.sh -a -d debug

Now like all good admins we will want test our first pass of the backup. For this we will use the option

-d dryrun

I suggest you run your first pass like this

./ghettoVCB.sh -a -d dryrun

This will let you know a few things before going live:

1.Duration of backup
2.Verify if your variables are defined correctly

OK that’s it..You should have everything you need to start backing your VMs. Going forward you will probably want to schedule this script to run regularly to make sure you have consistent backups. To schedule this script will need to create a cron job, and that my friends is a different subject altogether

Have fun
@piettov

Read More →
Replies: 0 / Share: