Zimbra Network Edition Backup with Bacula

There are several Bacula options for Zimbra backup:

The Zimbra Network Edition Backup (https://wiki.zimbra.com/wiki/5.0.x_Network_Edition_Backup_and_Restore) is operated by the Zimbra GUI and apparently does not have named pipes functionality. In this way, space is required on the Zimbra client machine to store at least one Full backup and some Incremental ones. The advantage of this is that the Zimbra administrator can restore objects quite quickly. For greater retention and disaster recovery, we copy these backups to Bacula Storage.

Bacula Pre-Backup Script (ClientRunBeforeJob)

With the following script configured in Bacula’s ClientRunBeforeJob directive, when running a Backup Job it will start a local backup of Zimbra Network Edition. If you start a Full Bacula backup, the script will run Full on Zimbra. If you start a Differential or Incremental Bacula, it will start an incremental in Zimbra.

#!/bin/bash
#
# ClientRunBeforeJob
# /opt/bacula/scripts/bacula_zimbra.sh %l
#
# Include
# /opt/zimbra/backup/
#
# Script para iniciar backup do Zimbra Network
#
# Autoria: Heitor Faria.
# Testado por: xxxx
# 

if [ $1 == Differential ]
then
sudo -u zimbra /opt/zimbra/bin/zmbackup -i
elif [ $1 == Incremental ]
then
sudo -u zimbra /opt/zimbra/bin/zmbackup -i
elif [ $1 == Full ]
then
sudo -u zimbra /opt/zimbra/bin/zmbackup -f -a all
else
echo "Backup level not identified"
fi

As shown in Figure 1, if you are using Bacula Enterprise, you can configure the pre and post-job backup scripts through the exclusive Bweb graphical interface.

Zimbra Network Edition Backup with Bacula 1

Figure 1. Bweb Jobs Configuration

FileSet

The default folder where Zimbra Network stores the backups is /opt/zimbra/backup/. Be sure to specify in the FileSet Include. Ex.:

Fileset {
  Name = "zimbra_networkbkp_integration"
  Include {
   Options {
    Compression = Lzo
    Signature = Md5
   }
   File = "/opt/zimbra/backup/"
  }
}

As shown in Figure 2, if you are using the Enterprise Bacula GUI you can append Include to FileSet through Bweb’s file and directory browser.

Zimbra Network Edition Backup with Bacula 2

Figure 2. Bweb FileSet Configuration, File Browser on Client

Bacula Post-Backup Script (ClientRunAfterJob)

With the following script configured in Bacula’s ClientRunAfterJob directive, you can delete local backups of the Zimbra Client machine after a certain time.

In the following example I used 7 days, which would be the time required to do a full weekly backup and incremental daily. Larger times can be used.

echo "
#!/bin/bash
#
# ClientRunBeforeJob
# /opt/bacula/scripts/bacula_zimbra_delete.sh 
#
# Script para apagar backups Zimbra Network após 7 dias
#
# Autoria: Heitor Faria.
# Testado por: xxxx
# 
sudo -u zimbra /opt/zimbra/bin/zmbackup -del 7d" > /opt/bacula/scripts/bacula_zimbra_delete.sh

Conclusion

Today CBacula and Ebacula are the most complete backup systems on the market, providing a free solution for users who want to use named pipes and scripts to backup specific applications, the Bacula Community, and another proprietary solution for users who want to purchase a more automated backup system with more advanced functionalities, Bacula Enterprise.

Contact us today. We can greatly reduce costs with high quality backup.

Disponível em: pt-brPortuguês (Portuguese (Brazil)) enEnglish esEspañol (Spanish)

Leave a Reply

Close Menu