Automated consistent VMware vCSA Backup

By | 2018-03-23

For years we have made a backup of all our VMware vCenter Server Appliances through our “normal” backup tool Veeam Backup and Replication. After a big incident with one of our biggest vCSA we identified, that this backup method isn’t consistent and our databases were corrupted. After multiple hours VMware support call we fixed our databases and our vCSA was running again.

After this incident we looked for another, better backup solution for our vCSAs and found the “official” VMware way:

Because this method has a bug with all browsers except internet explorer and we need to automate this backup, we have found this script from the VMware vSphere Documentation Center.

I have made a few bugfixes and improvments for this script and it can now be found in my GitHub Repository.

Additionally there are two more scripts: cleanup.sh and monitor.sh.

These scripts can now be run with crontab and gives you a automated and consistent vCSA backup 🙂

With the following code sniplet you can monitor your vCSA backups with nagios:

command[check_vcsa_backup] = /home/vmware/monitor.sh vcsa-fqdn.example.com

EDIT: starting with VMware vSphere 6.7 the backup schedule is included in the vCenter Server and the BASH scripts aren’t needed anymore. Find some more informations in my second blog post for vCSA Backup.

4 thoughts on “Automated consistent VMware vCSA Backup

  1. Pingback: vSphere 6.7: Automated consistent VMware vCSA Backup – Alex' Blog

  2. Premnath Bangar

    Dear Friend,

    I am getting below errors while running the above script.

    root@dcvc01 [ /opt ]# sh backup.sh

    backup.sh: line 37: log/task-72.22.26.50.json: No such file or directory
    backup.sh: line 51: log/backup-72.22.26.50.log: No such file or directory
    backup.sh: line 52: log/backup-72.22.26.50.log: No such file or directory
    backup.sh: line 58: log/backup-72.22.26.50.log: No such file or directory
    backup.sh: line 59: log/backup-72.22.26.50.log: No such file or directory
    awk: cmd. line:1: fatal: cannot open file `log/response-72.22.26.50.txt’ for reading (No such file or directory)
    backup.sh: line 63: log/backup-72.22.26.50.log: No such file or directory

    backup.sh: line 70: log/backup-72.22.26.50.log: No such file or directory
    backup.sh: line 72: log/response-72.22.26.50.txt: No such file or directory
    backup.sh: line 77: log/backup-72.22.26.50.log: No such file or directory
    backup.sh: line 78: log/backup-72.22.26.50.log: No such file or directory
    awk: cmd. line:1: fatal: cannot open file `log/response-72.22.26.50.txt’ for reading (No such file or directory)
    backup.sh: line 80: log/backup-72.22.26.50.log: No such file or directory
    backup.sh: line 83: log/backup-72.22.26.50.log: No such file or directory
    backup.sh: line 84: log/backup-72.22.26.50.log: No such file or directory
    root@dcvc01 [ /opt ]#

    Regards,
    Prem

    Reply
    1. alex Post author

      I think you need to manually create the folders “log”, “data” etc.

      Reply
  3. Pingback: VMware vCenter Appliance 6.7 (VCSA) Backup to NFS – Alex' Blog

Leave a Reply to Premnath Bangar Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.