Servers & VPS

How to Back Up Your VPS Server: Methods and Tools

Learn the most reliable methods and tools to back up your VPS server and keep your data safe from any failure.

Detailed image of a server rack with glowing lights in a modern data center.

To back up a VPS server, you have three core methods: provider snapshots, file-level backups with rsync, and database dumps. Combining all three gives you a solid recovery strategy for any failure scenario.

Losing data on a poorly backed-up server is one of the most expensive mistakes in web projects. This guide walks you through building a complete backup strategy without relying solely on your hosting provider.

Why Your Provider's Backup Isn't Enough

Most VPS providers offer automatic backups as an add-on. They're useful, but come with serious limitations:

  • They're stored on the same provider infrastructure — a catastrophic failure can take your backup down too.
  • Frequency is typically daily or weekly, meaning potential loss of hours of work.
  • Restoration can take hours and is rarely granular — you can't restore just one file.

The professional standard is the 3-2-1 rule: 3 copies of data, on 2 different media types, with 1 copy offsite. Your provider's snapshot covers only one of those fronts.

Method 1: Provider Snapshots

A snapshot is a full disk image taken at a specific point in time. Most control panels (DigitalOcean, Linode, Hetzner, Vultr) let you create them from the web interface or via API.

Creating a snapshot on DigitalOcean:

  1. Power down the Droplet (or use a live snapshot if your provider supports it).
  2. Go to Backups & Snapshots in the dashboard.
  3. Click Take Snapshot and wait for it to complete.
  4. Note the name and date — snapshots are billed per GB/month.

Pros: fast, requires no server-side setup, restores in minutes.

Cons: extra cost, not granular, provider-dependent.

Method 2: File Backup with rsync

rsync is the standard tool for syncing files between servers incrementally. It only transfers what changed since the last backup, saving time and bandwidth.

From a remote server (or your local machine with SSH access), run:

rsync -avz --delete -e ssh root@VPS_IP:/var/www/ /backups/vps-web/
  • -a: archive mode (preserves permissions, timestamps, symlinks).
  • -v: verbose — shows what's being transferred.
  • -z: compresses data in transit.
  • --delete: removes files at destination that no longer exist at source.

For versioned backups, combine rsync with hard links — each backup looks complete but only uses space for changed files:

rsync -avz --link-dest=/backups/vps-web/latest/ \
  root@VPS_IP:/var/www/ /backups/vps-web/$(date +%F)/

Method 3: Database Dump

Application files are only half the story. If you use MySQL/MariaDB or PostgreSQL, a filesystem backup does not guarantee database consistency if it's active during the backup.

For MySQL/MariaDB:

mysqldump -u root -p --all-databases --single-transaction \
  | gzip > /backups/db-$(date +%F).sql.gz

The --single-transaction flag dumps without locking InnoDB tables. For PostgreSQL:

pg_dumpall -U postgres | gzip > /backups/db-$(date +%F).sql.gz

Then copy the compressed file to an external destination with rsync or scp.

Automation: crontab + Bash Script

A manual backup that never runs is worthless. Automate with cron on your VPS itself or on a separate backup server.

Create the script /usr/local/bin/vps-backup.sh:

#!/bin/bash
DATE=$(date +%F)
DEST=/backups/vps/$DATE

mkdir -p "$DEST"

# Web file backup
rsync -az /var/www/ "$DEST/www/"

# Database dump
mysqldump -u root -p'PASSWORD' --all-databases \
  --single-transaction | gzip > "$DEST/db.sql.gz"

# Delete backups older than 14 days
find /backups/vps/ -maxdepth 1 -type d -mtime +14 -exec rm -rf {} +

Add it to crontab (crontab -e) to run every night at 2 AM:

0 2 * * * /usr/local/bin/vps-backup.sh >> /var/log/vps-backup.log 2>&1

To push backups to S3 or Backblaze B2, a tool like rclone handles it in one extra line. For a complete infrastructure strategy, the team at elenlace.com can help you design the right architecture from the ground up.

Explore more related topics in our VPS servers section.

Key Takeaways

  • Don't rely solely on your provider's backup — apply the 3-2-1 rule.
  • Snapshots are fast but costly and not granular; use them as a complement.
  • rsync with hard links gives efficient incremental file-level backups.
  • Database dumps are essential for data consistency.
  • Automate with cron and periodically verify your backups are actually restorable.

Ready to protect your VPS? Contact us at elenlace.com and we'll help you implement a backup strategy tailored to your project.

FAQ

How often should I back up my VPS?

It depends on how frequently your data changes. For active sites with a database, daily DB backups and weekly full file backups are ideal. For static projects, a weekly backup is usually enough.

Are provider backups sufficient on their own?

No. They're a useful layer of protection, but don't guarantee availability if the provider has a major failure, and they're rarely granular. Combine them with your own backups stored in an external location.

How do I verify my backup can actually be restored?

Periodically (at least once a month) restore the backup to a test VPS and confirm the application works correctly. A backup you've never tested is not a real backup.

How much storage do I need for backups?

With incremental rsync and hard links, each additional backup only uses space for changed files. As a reference, 14 days of backups for a typical 5 GB site rarely exceeds 10-12 GB total.

Useful resources

Other providers and guides worth comparing:

← All