
Free VMware Backups with ghettoVCB
ghettoVCB.sh is one of the few good scripts I know that can help us make copies of our VMware environment for free, This is, we will be able to make backups on both ESX and ESXi servers without a license! We can say that it behaves the same as the traditional VCB, Takes a snapshot of the virtual machine to be copied, It copies the virtual machine's files to a directory and then deletes the snapshot.
ghettoVCB is a script that must be run on the VMware ESX server itself(i), we can schedule it to run using 'Cron’ or as in my case I will run it from a remote computer using the utility plink.exe. In addition, ghettoVCB stores backups in an ESX datastore(i), In this document we will see at the end how to make the backup in a Windows folder that we have thanks to NFS.
The first thing is to download the script from HERE, In addition, You have the official documentation and the download link at: http://communities.vmware.com/docs/DOC-8760.
We save it on the ESX server(i), we can upload it to the server with a utility such as WinSCP or FastSCP that through SSH we can make secure file transfers to the ESX hosts(i) (previously we must have SSH access to the hosts enabled), We store it in a datastore, wherever we want, we decompress it with: 'tar -zxvf ghettoVCB.tar.gz’
We enter the directory that has just been generated for us and edit the configuration file with: 'vi ghettoVCB.conf'. In this file we will indicate where the backup will be made (VM_BACKUP_VOLUME), if we want the format of the copy to be only of what is used or respecting the entire size (DISK_BACKUP_FORMAT thin or thick), if we want to compress it, if we want to target NFS it would be configured here (for now in this example it is not configured)…
If we want to create a file with a list of the virtual machines to be backed up, we can later indicate it when executing the script with the -f parameter, or if we want to back up all the virtual machines that are running on this host we would put the -a parameter. Running the script once the ghettoVCB.conf file is configured: './ghettoVCB.sh -f FICHERO_LISTA_MV -g /PATH/FICHERO_CONFIGURACIÓN’
Depending on the structure of our systems, the copy will take more or less.
If we want, we will be able to schedule the execution of the ghettoVCB.sh script through Cron so that it runs periodically from the VMware hosts as it would be configured in any Linux. If we prefer to run it remotely, We can through plink.exe run it from a Windows and even setting this up as a BAT/CMD and setting it as a scheduled task. To run it: 'plink.exe usuario@host -pw PASSWORD “COMMAND TO RUN”‘.
If we want, we can make these copies in datastores that we will place on our Windows, for this we will use NFS, we can install the role on a Windows “Services for NEtwork File System” and share a folder on our local disks to store backups there, be on an external USB drive, on a local disk, a network folder…
Once that role is installed, we go to the folder we want to share as an NFS destination so that the ESX host(i) Connect, on the “Safety” We add to “Anonymous” with all permissions.
Apart from, We enter your tab “NFS Sharing” and we share the folder, We will check the option “Allow anonymous access” and we put “Anonymous UID” a 0 and “Anonymous GID” also to 0. We click on the “Permissions” and we add the ESX host(s)(i) that we want them to agree (or we put ALL EQUIPMENT), Put “Reading and writing” and “Allow root access”.
In addition, so that it does not give us errors in the properties of the “Server for NFS” from the console “Services for Network File System” and in transport protocol we put only “TCP”. And we can also open the policy console with gpedit.msc (GPO) Local, We're going to “Team Setup” > “Windows Settings” > “Security Settings” > “Local Directives” > “Security Options” and enable the “Network Access: Allow All permissions to be applied to anonymous users”.
Now from the host, since “Configuration” > “Storage” Click on “Add Storage…”, Select “Network File System” & “Next”,
In “Server” we put the name/IP of the NFS server, in “Folder” folder and indicate the name of the datastore.
Ready, we have it there assembled. Now all that remains is for us to modify/add the following configuration lines in the ghettoVCB.conf file so that the backups are saved on the NFS device:
UNMOUNT_NFS=0
NFS_SERVER=SERVIDOR_NFS
NFS_MOUNT=/PATH
NFS_LOCAL_NAME=NAME
NFS_VM_BACKUP_DIR=ROUTE