UnderHost
Knowledgebase Docs

VPS backup strategies-protect your server data

VPS plans require you to set up your own backups. This guide covers snapshots, rsync, database dumps, cron-based automation, and off-server storage options.

On this page

VPS servers require proactive backup planning. Unlike shared hosting where UnderHost runs server-level backups, a VPS is your responsibility. Set up at least one of these strategies before putting anything important on your VPS.

VPS snapshots

Some UnderHost VPS plans support snapshots from CustomerPanel. A snapshot is a point-in-time image of your entire disk. To take one:

  1. Log in to CustomerPanel → Services → your VPS
  2. Look for the Snapshots section
  3. Click Create Snapshot
Snapshots are not a substitute for off-server backups

Snapshots are stored on the same infrastructure as your VPS. If there is a datacenter issue or the VPS is accidentally deleted, the snapshot may be lost too. Always keep a separate copy off the server.

File backups with rsync

rsync efficiently copies files from your VPS to another server or NAS, only transferring changed files:

# Run from your backup destination server
rsync -avz --delete root@your-vps-ip:/var/www/ /backups/vps-web/

Or push from the VPS to a remote backup location:

rsync -avz /var/www/ user@backup-server:/backups/vps-web/

Database backups

Use mysqldump to export all databases:

mysqldump -u root -p --all-databases > /backups/all-databases-$(date +%F).sql

For a single database:

mysqldump -u root -p mydb > /backups/mydb-$(date +%F).sql

Automating with cron

Create a backup script and run it via crontab:

#!/bin/bash
DATE=$(date +%F)
BACKUP_DIR="/backups/$DATE"
mkdir -p "$BACKUP_DIR"
mysqldump -u root -p'yourpassword' --all-databases > "$BACKUP_DIR/databases.sql"
tar -czf "$BACKUP_DIR/www.tar.gz" /var/www/
# Delete backups older than 7 days
find /backups -maxdepth 1 -type d -mtime +7 -exec rm -rf {} ;

Schedule it with crontab -e:

0 3 * * * /root/backup.sh

Off-server storage

Options for storing backups away from the VPS:

  • Backblaze B2-very cheap cloud storage, compatible with rclone
  • Amazon S3-reliable, widely supported
  • A second VPS or server-rsync directly between servers
  • Your local machine-rsync or SCP to your own computer

Use rclone to sync backups to cloud storage from the command line-supports B2, S3, Google Drive, and many others.

Was this article helpful?

Setup VPS backups

Our NOC team can help you configure automated backup strategies for your VPS.

Related articles

Back to Backups