VMware Virtual Machines Back up With Bacula and GhettoVCB
Enable SSH service on ESXi
On the vSphere Client click on the configuration tab
Click on Security Profile
Now open the Properties tab so you cen see the Security Profile properties and the Remote Access services.
Select the SSH Service and click on Options. This will open up a new Windows where you can start the SSH service for your VMware ESXi 5.5 host and also set the startup properties for the service.
Now you should be able to access your VMware vSphere ESXi host via SSH. If you have any problems to connect you should also check out the firewall of your ESXi server.
Ghetto VCB Download and Configuration:
Get the GhettoVCB zip package from your workstation (master.zip):
Copy the package to the root of the ESXi server (example):
scp master.zip firstname.lastname@example.org://
Access the ESXi server via SSH. Unzip the master.zip file:
Ascend to the created script folder:
Configure the script:
The core values are to change the directory where the intermediate backup of the VM and the amount of versions of local back ups to be stored. As I intend to copy them with Bacula it is not necessary to store more than one version.
Alternatively you could save this backup ghuetto on another server via NFS and also configure sending e-mail , which is not included in this guide as I want to leave these functions to Bacula .
Give execute permission on the script of the ghetto that starts backups:
chmod o+rx ghettoVCB.sh
Run the script for testing purposes . You can back up all the machines with the -a option or you can specify the name of the same ( the name of the configured virtual machine on the client cSphere – case sensitive):
ghettoVCB.sh -g /ghettoVCB-master/ghettoVCB.conf -m VM-NAME
You can configure the ESXi cron to run the ghetto in a desired frequency or can set up a script before Bacula backup Job .
Because you can not install Bacula client on the ESXi alternative is to call the script from another server and copy the generated backup. You can also have a post- backup script to delete the ghetto inermediário go up after the Bacula have copied to the storage .
To call the script remotely installe the sshpass . Example:
apt-get install sshpass
Configure a backup job to call the script (in this case did a job for each VM):
Name = "Backup_Esxi_VM-NAME"
JobDefs = "DefaultJob"
Client = srv-backup-fd
FileSet = VM-NAME
ClientRunBeforeJob = "sshpass -p 'xxxx' ssh -o StrictHostKeyChecking=no email@example.com /ghettoVCB-master/ghettoVCB.sh -g /ghettoVCB-master/ghettoVCB.conf -m VM-NAME"
ClientRunAfterJob = "sshpass -p 'xxxx' ssh -o StrictHostKeyChecking=no firstname.lastname@example.org rm -rf /vmfs/volumes/datastore1/backup/VM-NAME"
Schedule = vms-schedule
Priority = 10
To copy the backup intermediate ghetto to another server, an scp script could be done or can be used bpipe plugin Bacula for this purpose , with the advantage of going straight for data backup and do not occupy space on another server:
Name = "VM-NAME"
signature = MD5
Compression = GZIP1
Plugin = "bpipe:/mnt/bkp_VM-NAME.tar:sshpass -p 'xxxx' ssh -o StrictHostKeyChecking=no email@example.com /bin/tar -c /vmfs/volumes/datastore1/backup/VM-NAME:/bin/tar -C /backup/bacula-restores -xvf -"
In this example the Bacula will restore the backup on the machine where your client is installed (/backup/bacula- restores). For the restore will be necessary to copy the files to the ESXi server and using the script of the ghetto (ghettoVCB-restore.sh) to import the back up to vSphere .