VPS Backups: How to Protect Your Data
By Harborvm8 min read
Key takeaways
- A VPS backup strategy means keeping your own copies. Snapshots on the same host are not a backup.
- Follow the 3-2-1 rule: three copies, two media types, one copy off-site. US-CERT and CISA have recommended it for years.
- Automate backups with cron and a short script, then store a copy off the server.
- A backup you have never restored is a guess. Test restores on a schedule.
- Ransomware was involved in 44% of breaches in the 2025 Verizon DBIR, which is why off-site, offline copies matter.
A sound VPS backup strategy means one thing: you always hold your own, independent copies of your data, stored somewhere the server itself cannot take down. Build that, test it, and you can recover from a deleted file, a corrupt database or a dead disk. Skip it, and a single bad command or failed drive can erase months of work.
This guide walks through a backup plan you can run on any Linux VPS. We cover why snapshots alone fall short, the 3-2-1 rule, how to automate backups with cron, how to store copies off-site, and how to plan for the worst case. The commands are plain and work on Ubuntu, Debian, AlmaLinux, Rocky Linux and Fedora.
One note up front. We at Harborvm do not offer backups or snapshots. You keep your own copies. That shapes this guide: everything here is something you set up and control, which is how a backup should work anyway.
Why Snapshots Alone Are Not a Backup Strategy
A snapshot is a point-in-time image of your server, and it is useful, but it usually lives on the same host as the server it protects. If that host fails, you can lose both the server and the snapshot together. A backup is a separate, independent copy stored somewhere else.
The distinction matters most during the events you most want to survive. Ransomware was involved in 44% of all data breaches in the 2025 Verizon Data Breach Investigations Report, up from 32% the year before (Verizon 2025 DBIR, via Flashpoint, 2025). Attackers go after live systems and anything reachable from them. A snapshot sitting beside the server is reachable. An off-site copy is not.
Small operators carry more of this risk than most expect. In the same 2025 report, 88% of breaches at small and medium businesses involved ransomware, compared with 39% at large enterprises (Verizon 2025 DBIR, via Flashpoint, 2025). If you run a VPS for a side project or a small company, you are squarely in that group.
Use snapshots if your provider offers them, for fast rollbacks during upgrades. Harborvm does not, so on our platform your copies are the backups you make yourself. Treat them as a convenience, never as your safety net. The safety net is a copy that lives elsewhere.

The 3-2-1 Backup Rule for Servers
The 3-2-1 rule is the baseline every server backup plan should meet: keep three copies of your data, on two different types of media, with one copy off-site. US-CERT credited the rule in official guidance, and CISA, its successor, still recommends it (CISA, Data Backup Options). The photographer Peter Krogh first framed it years earlier.
Here is what each number means for a VPS:
- Three copies. The live data on your server, plus two backups. One copy is one failure away from zero.
- Two media types. Do not keep both backups in the same place or format. Local disk plus remote object storage counts as two.
- One off-site. At least one copy lives outside your VPS and ideally in a different region, so a single incident cannot reach both.
Krogh put the reasoning plainly: anything you hold on only one drive is a thing you do not mind losing. That is the test. Walk through your data and ask where each piece actually lives. If the honest answer is "only on the server", you have no backup yet.
A common modern addition is 3-2-1-1: one of the off-site copies is kept offline or immutable, so ransomware cannot encrypt it. For a small VPS, that can be as simple as copying a weekly archive to storage the server has no standing credentials to overwrite.
Automating Backups With Cron and Scripts
Manual backups get skipped, so automate them. A short shell script plus a cron job gives you reliable, repeatable backups with no daily effort. The script gathers what matters, compresses it, and names the file by date so you can tell copies apart.
Start with a script. This example archives a web directory and dumps a database:
#!/bin/bash
set -euo pipefail
STAMP=$(date +%F)
DEST=/var/backups
mkdir -p "$DEST"
# Files
tar -czf "$DEST/site-$STAMP.tar.gz" /var/www
# Database (adjust for your DB)
mysqldump -u backup -p"$DB_PASS" myapp > "$DEST/db-$STAMP.sql"
gzip "$DEST/db-$STAMP.sql"
# Keep only the last 7 days locally
find "$DEST" -type f -mtime +7 -delete
Make it executable and schedule it. To run every day at 02:30, add a line with crontab -e:
30 2 * * * /usr/local/bin/backup.sh >> /var/log/backup.log 2>&1
A few rules keep this trustworthy:
- Log the output. The redirect above writes both normal and error output to a log so you can confirm the job ran.
- Dump databases, do not copy their files. A live database file copied mid-write can be corrupt. Use
mysqldump,pg_dumpor your engine's dump tool. - Prune old copies. The
findline drops local archives older than seven days so the disk does not fill. Remember that Harborvm reserves your disk and never oversells it, but reserved space is still finite, so housekeeping matters. - Keep secrets out of the script. Read passwords from an environment file with tight permissions, not from the script body.
For context on watching disk and memory while these jobs run, see how to monitor VPS performance. Harborvm also shows live CPU, memory, disk and network graphs in the browser, which makes a growing backup directory easy to spot.

Storing Backups Off-Site and Testing Restores
A local backup protects you from a deleted file. An off-site copy protects you from losing the whole server. Push at least one copy off the VPS as soon as the daily archive is built, and never trust a backup you have not restored.
For the off-site copy, send your archives to storage outside the VPS. Object storage from a separate provider is the usual choice. A tool like rclone or rsync over SSH works well, and you can add it to the end of the same script:
rclone copy "$DEST" remote:my-vps-backups --include "*-$STAMP.*"
A few honest constraints on Harborvm to plan around. We do not provide a dedicated public IPv4 address; your VPS sits behind the server's IP with forwarded ports, which is fine for outbound backup uploads since those are connections you start. Outbound port 25 is blocked, so if your script emails you a report, send it through a relay on port 587 or 465, not port 25. The built-in per-customer private network and WireGuard VPN let you push backups to another of your own machines over an encrypted link.
Now the step most people skip: test the restore. A backup is a guess until you have rebuilt from it. On a schedule, do this:
- Spin up a spare VPS or a local container.
- Pull the latest archive from off-site storage.
- Extract the files and import the database dump.
- Confirm the site loads and the data is current.
The cost of not testing is measured in lost days. The 2025 IBM Cost of a Data Breach Report found an average breach lifecycle of 241 days to identify and contain (IBM Cost of a Data Breach 2025, via Help Net Security, 2025). A tested restore turns a potential disaster into an afternoon. For hardening the server you restore onto, work through how to secure your VPS.
Recovery Planning for Worst-Case Scenarios
Recovery planning is deciding, before anything breaks, exactly how you would rebuild. Write it down. When a disk dies or a server is compromised at 3am, a one-page plan beats trying to remember where the database password lived.
Keep the plan short and specific:
- Define what "recovered" means. List the services that must come back and the maximum data loss you can accept. If you back up daily, you accept up to a day of loss. Decide if that is tolerable per system.
- Record where each copy lives. Local path, off-site bucket, and the credentials to reach them. Store those credentials somewhere other than the VPS.
- Write the rebuild steps. Fresh OS install, restore files, import the database, point DNS. On Harborvm a fresh Linux VPS is ready in about a minute, so the slow part is your data, not the server.
- Assume the worst copy is gone. If ransomware or a mistake reaches your most recent backup, your offline or immutable copy is what saves you. This is why the extra "1" in 3-2-1-1 exists.
The financial stakes are real for small operators. The same 2025 IBM report put the global average data breach cost at $4.44 million, with the United States average at a record $10.22 million (IBM Cost of a Data Breach 2025, via Help Net Security, 2025). Those are enterprise averages, not your bill, but they show why holding clean, tested copies off-site is cheap insurance by comparison.
Your next step is concrete: write the backup script above, schedule it with cron, add one off-site copy, and book a restore test on your calendar for next week. On Harborvm you control every copy yourself, which is exactly how a backup you can trust should work.
Sources
- Verizon, 2025 Data Breach Investigations Report (via Flashpoint analysis), retrieved 2026-11-01, https://flashpoint.io/blog/key-trends-vulnerability-exploitation-ransomware-insights-2025-verizon-dbir/
- IBM, Cost of a Data Breach Report 2025 (via Help Net Security), retrieved 2026-11-01, https://www.helpnetsecurity.com/2025/08/04/ibm-cost-data-breach-report-2025/
- CISA / US-CERT, Data Backup Options, retrieved 2026-11-01, https://www.cisa.gov/sites/default/files/publications/data_backup_options.pdf
Frequently asked questions
What is the best VPS backup strategy?
The 3-2-1 rule is the baseline: keep three copies of your data, on two types of media, with one copy stored off-site. Automate it with cron and test your restores regularly.
Are snapshots the same as backups?
No. A snapshot usually lives on the same host as the server it protects. If that host fails, you lose both. A real backup is an independent copy stored elsewhere.
How often should I back up a VPS?
Match the interval to how much data you can afford to lose. Daily is common for small sites. Databases that change often may need hourly dumps plus a daily full copy.
Does Harborvm provide backups?
No. Harborvm does not offer backups or snapshots. You keep your own copies, which this guide shows you how to automate and store off-site.
Where should I store off-site backups?
Any location outside your VPS: object storage from a separate provider, a home NAS, or another server in a different region. The goal is that one failure cannot take out both copies.