There was a change in file level backup starting with VMware Cloud Director 10.3.1 as described in this article by VMware Backup and Restore of VMware Cloud Director Appliance. The VMware article unfortunately does not explain how the file level backup can easily be automated. I decided to create this blog post because it seems not everyone is aware about this change and therefore is in the wrong assumption that their backups still work. Always monitor your automated file creations or at least check them manually on a regular basis!
Configure automated Backups
Manual backups can either get created through the UI or the CLI starting from 10.3.1. The automated backups can either get created through the API or already existing scripts on the appliance. These scripts change in version 10.3.1 and that's why below adjustments are being required. Also the file location of the backups will change so make sure you adjust your cleanup script.
Backups prior to 10.3.1
Backups starting with 10.3.1
Automate the backups
Link the default script into /etc/cron.hourly to create backups at every full hour
ln -s /opt/vmware/appliance/bin/create-backup.sh /etc/cron.hourly/create-backup.sh
To add more granularity with crontab create a python script to call the db-backup.
#!/usr/bin/python import os os.system('/opt/vmware/appliance/bin/create-db-backup')
Automate file cleanup
Create a simple Python script to cleanup the files, make it executable and schedule it through cron. This example is showing the python script with the file location used after10.3.1. For Backups prior 10.3.1 use the path /opt/vmware/vcloud-director/data/transfer/pgdb-backup.
#!/usr/bin/python import os os.system('find /opt/vmware/vcloud-director/data/transfer/backups/backup-* -mtime +1 -type f -delete')