You've set up your VPS. Your website is running. But what happens if something breaks? A server can crash. A hard drive can fail. You can accidentally delete files. Without backups, you lose everything.

This guide covers practical backup strategies for VPS users, from simple file backups to full system snapshots.

What to Back Up

Before setting up backups, know what needs backing up:

  • Website files – Your WordPress files, HTML pages, PHP scripts, uploaded images. Usually located in /var/www/ or your home directory.
  • Database – If you run WordPress or any dynamic site, the database contains your posts, pages, comments, and settings.
  • Configuration files – Nginx or Apache configs, PHP settings, firewall rules. These are harder to rebuild from scratch.

Option 1: Simple File Backups with rsync

rsync is a command-line tool that copies files to another location. It only copies changed files, making it efficient:

rsync -avz -e ssh /var/www/ username@backupserver.com:/backups/

To automate this, add it to crontab to run daily at 2 AM.

Option 2: Database Backups with mysqldump

Create a backup script:

#!/bin/bash
DATE=$(date +%Y%m%d)
mysqldump -u username -ppassword database_name > /backups/db_$DATE.sql
gzip /backups/db_$DATE.sql
find /backups -type f -name "*.gz" -mtime +30 -delete

Add to crontab for daily backups at 3 AM.

Option 3: Off-site Backups with rclone

Local backups are good, but if your server fails completely, you need off-site backups. Install rclone and configure it for Google Drive, Dropbox, or Backblaze B2.

Backblaze B2 costs about $0.006 per GB per month – incredibly cheap for off-site storage.

Option 4: VPS Provider Snapshots

Most VPS providers offer snapshot features. Take a full system snapshot once a month. Costs vary but are usually a few dollars per snapshot.

Recommended Backup Strategy for Small Websites

Here's a solid strategy that's easy to implement:

  • Daily database backup – Use mysqldump. Keep 30 days of backups.
  • Weekly file backup – Use rsync or tar. Keep 4 weeks of backups.
  • Off-site storage – Use rclone to copy backups to Backblaze B2 or Google Drive.
  • Monthly snapshot – Most VPS providers offer snapshot features. Take a full system snapshot once a month.

Testing Your Backups

A backup that can't be restored is useless. Test regularly:

  • Test file restoration – Pick a random file from your backup and restore it to a different location.
  • Test database restoration – Create a test database and import your backup.
  • Test full restoration – Once a month, spin up a test VPS and restore everything from scratch.

Need a VPS to practice on? Check our recommended VPS providers.