Back up a database hosted on OVH
The 3-2-1 rule, off-site storage and automation, after the Strasbourg fire.
Hosting your database on OVH (VPS, dedicated server, Public Cloud) is an excellent choice. But a server, however reliable, is not a backup. The SBG2 datacenter fire in 2021 was a brutal reminder: customers whose backups sat in the same datacenter as their servers lost everything.
Here is how to back up a database on OVH properly.
1. The 3-2-1 rule
Three copies of your data, on two different media, one of them off-site. A backup stored on the same server, or in the same datacenter as the database, does not count as an off-site copy.
2. Export the database
Depending on your engine, use pg_dump (PostgreSQL) or mysqldump (MySQL / MariaDB) on your OVH server.
# PostgreSQL
pg_dump -Fc my_db > /var/backups/my_db.dump
# MySQL / MariaDB
mysqldump --single-transaction my_db | gzip > /var/backups/my_db.sql.gz
3. Move the backup off-site
Encrypt the backup, then copy it to an S3-compatible object storage, ideally in a different region than OVH Strasbourg, or at another provider. OVH Object Storage is S3-API compatible.
age -r age1example... -o my_db.dump.age my_db.dump
aws --endpoint-url https://s3.gra.io.cloud.ovh.net s3 cp my_db.dump.age s3://my-bucket/db/
Adjust the endpoint to your OVH region (gra, sbg, rbx, de, uk...).
4. Schedule and monitor
Automate with cron, and above all monitor: a backup that stops running or fails must raise an alert, otherwise you are flying blind.
What cron and a script do not give you
- No alert if the backup stops or fails.
- Encryption, retention and multi-region copy are all yours to maintain.
- No proof the restore works until you have actually tested it.
- Poorly isolated off-site storage (same credentials, same account) falls with the rest if compromised.
rlbk, built for European hosting
rlbk is published by a French company (MHR CONSULT, Paris), hosted on OVH, and built for GDPR. The agent encrypts your databases with age on your OVH server, sends them to rlbk or to your own bucket (OVH Object Storage, Scaleway, Backblaze...), alerts you the moment one fails, and lets you test your restores.
Your data stays with you, encrypted, and out of the datacenter that hosts your database.