VMware Virtual Machines Back up With Bacula and GhettoVCB

Enable SSH service on ESXi

On the vSphere Client click on the configuration tab

VMware ESXi vSphere Client Configuration

Click on Security Profile

VMware ESXi vSphere Client Security Profile

Now open the Properties tab so you cen see the Security Profile properties and the Remote Access services.

VMware ESXi vSphere Client Security Profile Properies

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.

VMware ESXi vSphere Client Start SSH 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.

VMware ESXi 5.5 Firewall

Ghetto VCB Download and Configuration:

Get the GhettoVCB zip package from your workstation (master.zip):

https://github.com/lamw/ghettoVCB

Copy the package to the root of the ESXi server (example):

scp master.zip root@192.168.1.10://

Access the ESXi server via SSH. Unzip the master.zip file:

cd /
unzip master.zip

Ascend to the created script folder:

cd ghettoVCB-master

Configure the script:

vi /backup/ghettoVCB-master/ghettoVCB.conf

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.

VM_BACKUP_VOLUME=/vmfs/volumes/datastore1/backup
DISK_BACKUP_FORMAT=thin
VM_BACKUP_ROTATION_COUNT=1
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=1
ENABLE_NON_PERSISTENT_NFS=0
UNMOUNT_NFS=0
NFS_SERVER=172.30.0.195
NFS_VERSION=nfs
NFS_MOUNT=/nfsshare
NFS_LOCAL_NAME=nfs_storage_backup
NFS_VM_BACKUP_DIR=mybackups
SNAPSHOT_TIMEOUT=15
EMAIL_ALERT=0
EMAIL_LOG=0
EMAIL_SERVER=auroa.primp-industries.com
EMAIL_SERVER_PORT=25
EMAIL_DELAY_INTERVAL=1
EMAIL_TO=auroa@primp-industries.com
EMAIL_ERRORS_TO=
EMAIL_FROM=root@ghettoVCB
WORKDIR_DEBUG=0
VM_SHUTDOWN_ORDER=
VM_STARTUP_ORDER=

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

Bacula Configuration

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):

Job {
 Name = "Backup_Esxi_VM-NAME"
JobDefs = "DefaultJob"
Client = srv-backup-fd
 FileSet = VM-NAME
 ClientRunBeforeJob = "sshpass -p 'xxxx' ssh -o StrictHostKeyChecking=no root@192.168.1.10 /ghettoVCB-master/ghettoVCB.sh -g /ghettoVCB-master/ghettoVCB.conf -m VM-NAME"
 ClientRunAfterJob = "sshpass -p 'xxxx' ssh -o StrictHostKeyChecking=no root@192.168.1.10 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:

FileSet {
 Name = "VM-NAME"
Include {
Options {
signature = MD5
Compression = GZIP1
}
 Plugin = "bpipe:/mnt/bkp_VM-NAME.tar:sshpass -p 'xxxx' ssh -o StrictHostKeyChecking=no root@192.168.10.x /bin/tar -c /vmfs/volumes/datastore1/backup/VM-NAME:/bin/tar -C /backup/bacula-restores -xvf -"
}
Exclude {
}
}

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 .

Disponível em: pt-brPortuguês (Portuguese (Brazil)) enEnglish

Leave a Reply

Close Menu