HostingB2B » How to » How to back up and restore data on VPS

How to back up and restore data on VPS

Summarize with:
Summarize with AI
Share:

Introduction

Data loss on a VPS stops a business instantly. Consequently, a solid backup and restore process is not optional. This guide covers what to back up, which method to use, restore steps, and pitfalls to avoid.

What Is VPS Backup?

A VPS backup copies data, configuration, and software state to a separate location for recovery after damage or loss. Snapshots capture the full disk at a point in time; file-level backups copy only selected directories or databases. Snapshots restore faster after total failure; file-level backups use less storage and suit granular recovery.

What to Back Up

Prioritise these three categories:

  • Files and directories: /var/www/, /etc/, /home/, and any custom application paths
  • Databases: use mysqldump for MySQL/MariaDB, pg_dump for PostgreSQL, mongodump for MongoDB. Never copy raw database files while the engine runs.
  • Configuration files: /etc/nginx/ or /etc/apache2/ configs, firewall rules, and cron definitions

Backup Options: Snapshots vs File-Level

Snapshots suit pre-change protection. HostingB2B VPS Hosting supports snapshot creation from the control panel. However, combine them with off-site backups because providers store snapshots within the same infrastructure. File-level backups using rsync or Duplicati work better for daily schedules and granular recovery.

The 3-2-1 Backup Strategy

When designing your backup workflow, always adhere to the industry-standard 3-2-1 rule:

  • 3 copies of data: Keep your production data and at least two distinct backup copies.
  • 2 different media types: Store backups on different storage systems (e.g., local VPS disk space and separate cloud object storage) to avoid a single point of failure.
  • 1 off-site location: Keep at least one backup copy entirely outside the primary data center infrastructure.

Utilizing HostingB2B snapshots satisfies the redundancy need, but replicating file-level or database backups to a remote region fulfills the vital off-site requirement. See the HostingB2B automated backup guide for step-by-step setup instructions.

Comparison Table

CriterionSnapshotFile-LevelBest For
SpeedFastModerateSnapshot
StorageHighLowFile-level
Restore scopeFull serverGranularSnapshot: full failure
Off-siteLimitedFlexibleFile-level

Common Use Cases by Industry

  • iGaming and Fintech: hourly database backups; reconcile records against payment logs; encrypt for PCI DSS
  • SaaS: isolate backups per tenant to allow independent restores without affecting other users
  • E-commerce: take a snapshot before every plugin update to enable a fast rollback

Enterprise Deployment Considerations

Retain daily backups for seven days, weekly for four weeks, monthly for twelve months. Replicate off-site, encrypt with GPG, and store keys separately. Visit the HostingB2B Knowledgebase for enterprise guidance.

How to Restore VPS Data

From a Snapshot

  1. Log in to the control panel and open the VPS snapshot list.
  2. Select the snapshot taken before the issue and start the restore.
  3. Wait two to ten minutes, then confirm SSH access and application status.

From a File-Level Backup

  • Connect via SSH and locate the backup archive or remote directory.
  • Extract files: tar -xzf backup.tar.gz -C /var/www/html/ or pull with rsync.
  • Fix ownership and permissions, then restart web and application services.

Database Restore

  • Create a clean empty database if the original no longer exists.
  • Import the dump: mysql -u root -p database_name < backup.sql
  • Confirm the import succeeded and restart the application.

Verification Steps

  • Run integration tests or visit key application pages
  • Query the database to confirm recent records exist
  • Review server logs for missing files or permission errors
  • Test HTTPS and confirm SSL certificates are valid

Complete all checks before informing users that service has resumed.

Common Pitfalls and Best Practices

  • Never copy a live database without a dump tool. Raw file copies corrupt silently.
  • Never store all backups on the same server. A single failure removes both.
  • Always test a restore before you need it. An untested backup provides no guarantee.
  • Always include configuration files. Rebuilding from memory wastes recovery time.
  • Monitor backup jobs actively. Automated schedules fail silently without alerting.

Frequently Asked Questions

How often should I back up my VPS?

Daily suits most workloads; every one to four hours for high-transaction databases.

Can I restore a single file from a snapshot?

Not directly. Restore the snapshot to a secondary VPS, copy the file over SSH, then delete the temporary server.

Get Professional VPS Backup Support

HostingB2B offers managed VPS hosting with built-in backup options and expert restore support. Review the VPS Hosting plans or visit the HostingB2B Knowledgebase for further technical guides.

Conclusion

Start by identifying what needs protection: files, databases, and configuration. Next, apply the 3-2-1 rule and choose the right backup method. Follow the matching restore procedure, verify results, and test backups regularly so gaps surface before a real failure does.

© 2026 All Rights Reserved. HostingB2B

Hosting B2B LTD is a Company registered in Cyprus with Company number HE410139 and VAT CY10410139C

Contact Info

© 2026 All Rights Reserved. HostingB2B