Backups for your server
Updated
A backup is a copy of your data that you can restore after a mistake, a hacked site or a failed disk. A server without a tested backup is a risk to your business. This guide explains who does what.
Self-managed servers: you are responsible
On a self-managed cloud server you run the system, so you are responsible for your backups. We keep the hardware running, but we do not copy your files or databases on our own.
- Snapshots on request. We can take a snapshot of the whole server on request. Mail support@it-labs.in to ask. A snapshot is useful before a big change, such as an upgrade. It is not a replacement for regular backups of your data. Ask us about the price before you rely on it.
- Your own backups. Copy your data to a different place: another server, another location, or storage you pay for elsewhere. A backup on the same disk is lost with the disk.
Managed servers: we do it
On a managed server we set up the backups and check that they run. Tell us what must be saved and how long to keep it. Your plan or the agreed offer states what is included. You still decide what the data is worth.
What to back up
- Website files and uploads.
- Databases. Use a dump, not a copy of the live database files:
mysqldump --single-transaction -u USER -p DBNAME > dbname-$(date +%F).sql
pg_dump -U USER DBNAME > dbname-$(date +%F).sql
- Configuration in
/etc, for example web server, mail and firewall settings. - Cron jobs and any scripts you wrote.
How often
Ask how much work you can afford to lose. For a busy shop, daily or more often. For a small static website, weekly may do. Keep several generations, for example 7 daily and 4 weekly copies, so that a problem found late can still be undone.
Copy it away with rsync
rsync -az --delete /var/www/ backupuser@backup-host:/backups/www/
Run it from cron. Use an SSH key for the backup user, and give it access to the backup folder only.
Test your restore
A backup that was never restored is only a hope. At least every few months:
- Restore the files and the database on a test server or in a separate folder.
- Open the site and check that pages, uploads and orders are there.
- Write down how long it took and which steps you needed.
Keep the written steps where you can find them when the server is down.