Backing up a large amount of OpenVZ containers can be a challenging task if not done correctly. Here are some best practices:
1. Use Built-In Utilities: OpenVZ has a built-in utility called “vzdump” that can perform a backup of a container. You could script this process to run on each container automatically.
1. External Storage: Backups should always be stored externally or off-site in addition to local storage to protect against physical damage to servers.
1. Incremental Backups: In addition to complete backups, incremental backups should be performed to capture changes since the last full backup. This way, in a catastrophic event, one would only lose data that was added between the last incremental backup and the time of the disaster.
1. Regularly Test Backups: The consistency and availability of backups should be tested routinely to ensure the quality and success of the backup function. There would be no use of a backup that cannot be restored successfully.
1. Container Stop: Stop the container before backup to ensure consistency, especially for databases. If that’s not possible, at least try to put services in a read-only mode during backup.
1. Using 3-2-1 Rule: Make sure to have three copies of your data; store two backup copies on different devices or storage media and one copy to be kept offsite.
1. Backup Rotation: Using Grandfather-father-son backup (GFS), the scheduling scheme can help optimize storage used for backups and ensures that there are always multiple backup versions available from different points in time.
Each infrastructure is unique, so make sure the method you implement works well for your needs. Remember, the best backup strategy is one that gets tested frequently.