Introduction: Why VPS Backups Matter
A VPS gives you more control than shared hosting, but it also gives you more responsibility. When you rent a virtual private server, you usually control the files, databases, applications, firewall rules, users, and server configuration. That flexibility is useful, but it also means a mistake can affect your entire website, app, trading platform, database, or business tool.
That is why learning how to back up and restore data on VPS environments is one of the most important skills for any server owner. A backup is not only a copy of files. A good VPS backup plan protects your website code, databases, user uploads, email data, configuration files, SSL certificates, application secrets, cron jobs, control panel settings, and recovery process.
Many VPS problems do not come from hardware failure alone. Data can be lost because of a bad update, accidental file deletion, malware, a broken plugin, database corruption, a failed migration, expired storage, or an administrator mistake. If you have a working backup and a tested restore process, these problems become recoverable. Without backups, a small issue can become a full outage.
This guide explains how VPS backup and restore works in 2026, including manual Linux backups, rsync backups, database backups, Windows VPS backups, control panel backups, provider snapshots, off-server storage, restoration steps, and a practical checklist. The goal is to help you build a backup strategy that is realistic, secure, and easy to recover from.
Quick Answer: What Is the Best Way to Back Up a VPS?
The best way to back up a VPS is to use a layered backup strategy. Do not rely on only one backup type. A practical setup usually includes provider snapshots for fast rollback, file-level backups for websites and applications, database backups for MySQL or PostgreSQL, and off-server backups stored away from the VPS.
For most VPS users, the best backup strategy looks like this:
- Daily file backups for website files, uploads, app code, and configuration.
- Daily database backups for MySQL, MariaDB, PostgreSQL, or other databases.
- Weekly full-server backups or provider snapshots for easier rollback.
- Off-server backup storage so backups are not lost if the VPS is deleted or compromised.
- Regular restore testing to confirm backups actually work.
- Backup encryption when backups contain private user data, payment data, customer data, or business files.
If your VPS runs a simple WordPress site, a control panel backup plus database export may be enough. If your VPS runs an ecommerce site, SaaS app, game server, Forex trading setup, or business database, you need a stricter plan with more frequent backup points and a tested restore workflow.
Before choosing a backup method, also review your VPS management model. A managed VPS may include provider-assisted backups, monitoring, and restore help, while an unmanaged VPS usually requires you to configure and test backups yourself. If you are still comparing both options, read our guide on managed vs unmanaged VPS.
What Data Should You Back Up on a VPS?
A common mistake is backing up only the website folder and forgetting everything else the server needs to function. A VPS backup should protect all critical data required to rebuild or restore the service.
1. Website and Application Files
Back up your website document roots, application folders, themes, plugins, media uploads, custom code, static files, and deployment directories. Common locations include /var/www/, /home/username/public_html/, /srv/, or custom app directories.
For WordPress, user-uploaded media is often more important than the core files because WordPress itself can be reinstalled, but original uploads may not be easy to recreate. For custom applications, the entire codebase and environment files may matter.
2. Databases
Most modern sites store important content in a database. WordPress posts, WooCommerce orders, user accounts, product catalogs, forum posts, app data, and customer records are usually stored in MySQL, MariaDB, PostgreSQL, MongoDB, or another database engine.
Never assume a file backup alone protects a dynamic website. You usually need a database dump or a database-aware backup method. For MySQL and MariaDB, common tools include mysqldump and mariadb-dump. For PostgreSQL, common tools include pg_dump and pg_dumpall.
3. Server Configuration Files
Configuration files control how the server behaves. These may include Nginx or Apache virtual hosts, PHP settings, firewall rules, SSH settings, systemd services, cron jobs, Docker Compose files, SSL certificate paths, and application environment variables.
Useful paths to review include:
/etc/nginx//etc/apache2/or/etc/httpd//etc/php//etc/ssh//etc/letsencrypt//etc/systemd/system//etc/crontaband user crontabs- application
.envfiles
4. User Accounts and Permissions
If your server has multiple system users, hosting accounts, or application users, back up the relevant home directories and permission structure. Restoring files without proper ownership can break websites and services.
5. Email and DNS Data
If your VPS hosts email, you need to back up mailboxes, mail server configuration, spam filtering settings, DKIM keys, and related DNS records. Email hosting is easy to underestimate. A website can sometimes be rebuilt from a CMS backup, but lost email archives may be impossible to recreate.
6. Control Panel Data
If you use cPanel, Plesk, DirectAdmin, Webmin, or another panel, use the panel’s official backup feature when possible. Control panel backups often include account structure, domains, email, databases, DNS zones, and web files in a more restorable format.
If you are choosing a panel for a new VPS, compare options in our guide to the best web hosting control panel.
Main VPS Backup Methods
There are several ways to back up a VPS. The right method depends on your operating system, application stack, technical skill level, recovery time target, and budget.
1. Provider Snapshots
A snapshot is a point-in-time image of your VPS disk or server state. Snapshots are useful before risky updates, migrations, OS upgrades, control panel changes, or major application deployments.
Advantages of snapshots:
- Fast rollback after failed updates.
- Useful before risky configuration changes.
- Simple for non-technical users.
- Can restore the whole VPS quickly.
Limitations of snapshots:
- They may not be application-consistent if taken while databases are actively writing.
- They may be stored in the same provider environment.
- They are not a full disaster recovery plan by themselves.
- They can become expensive if retained for too long.
Snapshots are excellent for short-term rollback, but they should not replace off-server backups.
2. File-Level Backups
File-level backups copy selected folders and files. This is useful for website files, application directories, uploads, scripts, configuration files, and logs. File-level backups are flexible because you can restore one folder or one file instead of rolling back the entire server.
Popular file-level backup tools include rsync, scp, sftp, tar, backup scripts, and control panel file backup tools. The Linux rsync manual describes rsync as a fast and versatile file-copying tool that can copy locally or to and from remote hosts.
3. Database Backups
Database backups export structured data into restorable files. This matters because a database is not always safe to copy as raw files while it is running. For many VPS users, a scheduled database dump is safer and easier to restore.
Examples:
mysqldump -u root -p database_name > database_name.sql
pg_dump -U username database_name > database_name.sql
For busy production databases, consider proper locking, replication, binary logs, point-in-time recovery, or database-native backup tools. A simple dump may be enough for a small website, but it may not be enough for a high-traffic transactional application.
4. Control Panel Backups
Control panel backups are useful if your VPS is managed through cPanel, Plesk, DirectAdmin, or a similar panel. They can include domains, website files, databases, mailboxes, DNS settings, users, and account configuration.
For example, cPanel’s documentation describes backup and restore interfaces for site backup files and cPanel account restoration. Plesk’s documentation includes backup and restoration tools for server settings, user data, mail, user files, and databases.
Control panel backups are especially useful for agencies, freelancers, and users managing multiple websites. They are less ideal for custom application stacks that are not fully controlled by the panel.
5. Windows VPS Backups
If you run a Windows VPS, your backup strategy may include Windows Server Backup, third-party backup software, application backups, database backups, and provider snapshots. Microsoft’s Windows Server Backup documentation explains that Windows Server Backup can back up a full server, selected volumes, system state, files, and folders, and can also support bare metal recovery in disaster scenarios.
Windows VPS users should also back up application configuration, IIS sites, SQL Server databases, RDP-related settings, license files, and business application data. If you manage servers through Remote Desktop, our guide to the windows RDP client can help you choose the right tool for remote access.
6. Off-Server Backups
Off-server backups are backups stored outside the VPS. This is one of the most important parts of a serious backup strategy.
Off-server destinations can include:
- Another VPS
- Object storage
- Remote backup storage
- Private storage server
- NAS or NFS storage
- Cloud storage provider
- Colocation storage infrastructure
If a VPS is deleted, compromised, suspended, or corrupted, local backups stored on the same server may disappear with it. Off-server backups give you a separate recovery point. For storage-heavy environments, also review our guide to colocation hosting.
How to Back Up a Linux VPS Manually
Manual Linux VPS backups are useful when you want full control and do not depend on a control panel. The exact commands depend on your stack, but the basic process is usually the same: identify critical data, export databases, archive important files, transfer backups off-server, and test restoration.
Step 1: Create a Backup Directory
Start by creating a backup directory with restricted permissions:
sudo mkdir -p /root/backups
sudo chmod 700 /root/backups
This keeps temporary backup files away from public web directories. Avoid storing backups inside /var/www/html or any public folder.
Step 2: Back Up Website Files
Use tar to create a compressed archive of your website files:
sudo tar -czf /root/backups/website-files-$(date +%F).tar.gz /var/www/
If your sites are stored in a different folder, replace /var/www/ with the correct path. For cPanel-like setups, files may be inside /home/username/public_html/.
Step 3: Back Up Configuration Files
Create a separate configuration backup:
sudo tar -czf /root/backups/server-config-$(date +%F).tar.gz \
/etc/nginx \
/etc/apache2 \
/etc/php \
/etc/ssh \
/etc/letsencrypt \
/etc/systemd/system \
/etc/crontab
Some paths may not exist on every server. For example, RHEL-based systems often use /etc/httpd/ instead of /etc/apache2/.
Step 4: Back Up MySQL or MariaDB
For a single database:
mysqldump -u root -p database_name > /root/backups/database_name-$(date +%F).sql
For all databases:
mysqldump -u root -p --all-databases > /root/backups/all-databases-$(date +%F).sql
Then compress the SQL file:
gzip /root/backups/all-databases-$(date +%F).sql
Step 5: Back Up PostgreSQL
For a single PostgreSQL database:
sudo -u postgres pg_dump database_name > /root/backups/database_name-$(date +%F).sql
For all PostgreSQL databases:
sudo -u postgres pg_dumpall > /root/backups/postgres-all-$(date +%F).sql
Step 6: Transfer the Backup Off-Server
Use rsync over SSH to copy backups to another server:
rsync -avz -e ssh /root/backups/ backupuser@backup-server:/backups/my-vps/
This copies local backup files to a remote backup server. For automation, use SSH keys and a restricted backup user. Do not store production root passwords inside scripts.
Step 7: Remove Old Local Backups
To prevent your VPS disk from filling up, remove old local backup files after confirming remote copies are working:
find /root/backups -type f -mtime +7 -delete
This command deletes files older than seven days in the backup folder. Adjust retention based on your storage capacity and recovery needs.
How to Automate VPS Backups with Cron
Manual backups are useful, but they are easy to forget. Automation is the safer approach. On Linux, you can use cron to run backup scripts on a schedule.
Example Backup Script
Create a script:
sudo nano /usr/local/bin/vps-backup.sh
Add a basic structure:
#!/bin/bash
DATE=$(date +%F)
BACKUP_DIR="/root/backups/$DATE"
REMOTE="backupuser@backup-server:/backups/my-vps/"
mkdir -p "$BACKUP_DIR"
tar -czf "$BACKUP_DIR/website-files.tar.gz" /var/www/
tar -czf "$BACKUP_DIR/server-config.tar.gz" /etc/nginx /etc/php /etc/letsencrypt /etc/systemd/system 2>/dev/null
mysqldump -u root --all-databases > "$BACKUP_DIR/all-databases.sql"
gzip "$BACKUP_DIR/all-databases.sql"
rsync -avz -e ssh "$BACKUP_DIR/" "$REMOTE/$DATE/"
find /root/backups -type f -mtime +7 -delete
Make it executable:
sudo chmod +x /usr/local/bin/vps-backup.sh
Schedule the Backup
Edit cron:
sudo crontab -e
Run the backup every night at 2:30 AM:
30 2 * * * /usr/local/bin/vps-backup.sh >> /var/log/vps-backup.log 2>&1
After scheduling the script, check the log file and verify remote backups appear correctly. Automation without monitoring can create false confidence. You need to know when backups fail.
How to Restore Data on a Linux VPS
A backup is only useful if it can be restored. Restoration should be practiced before an emergency. The restore process depends on whether you are restoring one file, one database, one website, or the entire server.
Restore Website Files
Copy the backup archive to the VPS and extract it:
sudo tar -xzf website-files-2026-01-01.tar.gz -C /
Then check ownership and permissions:
sudo chown -R www-data:www-data /var/www/example.com
sudo find /var/www/example.com -type d -exec chmod 755 {} \;
sudo find /var/www/example.com -type f -exec chmod 644 {} \;
On RHEL-based systems, the web server user may be apache instead of www-data.
Restore a MySQL or MariaDB Database
Create the database if needed:
mysql -u root -p -e "CREATE DATABASE database_name;"
Restore the SQL dump:
mysql -u root -p database_name < database_name.sql
If the dump is compressed:
gunzip database_name.sql.gz
mysql -u root -p database_name < database_name.sql
Restore PostgreSQL
Create the database:
sudo -u postgres createdb database_name
Restore the dump:
sudo -u postgres psql database_name < database_name.sql
Restore Configuration Files
Restore configuration files carefully. Do not blindly overwrite system configuration on a new OS version without checking compatibility.
sudo tar -xzf server-config-2026-01-01.tar.gz -C /
After restoring configuration, test services before restarting:
sudo nginx -t
sudo systemctl restart nginx
For Apache:
sudo apachectl configtest
sudo systemctl restart apache2
Restore SSL Certificates
If you backed up /etc/letsencrypt/, you may be able to restore certificates and renewal configuration. If not, you can usually issue new certificates after DNS points to the restored server.
After restoring SSL files, test renewal:
sudo certbot renew --dry-run
How to Back Up and Restore a VPS with cPanel
If your VPS runs cPanel, use cPanel and WHM backup features when possible. cPanel backup files are designed to restore hosting accounts more cleanly than random file copies.
Typical cPanel backup options include:
- Full account backups
- Home directory backups
- MySQL database backups
- Email forwarder backups
- Email filter backups
- WHM account restoration
cPanel’s official documentation explains that its Backup interface lets users download and store a site in a backup file and restore website data from backup files. WHM also includes backup restoration for cPanel accounts from local or remote backup destinations.
Best practices for cPanel VPS backups:
- Schedule automated backups in WHM.
- Store backups on remote storage, not only the local VPS.
- Test restoring at least one account.
- Keep enough retention points to recover from delayed malware or accidental deletion.
- Monitor backup disk usage.
How to Back Up and Restore a VPS with Plesk
Plesk also includes backup and restoration tools for VPS users who prefer a web control panel. Plesk documentation describes server backup options that can include server settings, mail messages, user files, and databases.
Typical Plesk backup options include:
- Full server backups
- Subscription backups
- Website backups
- Database backups
- Scheduled backups
- Remote storage backups
Best practices for Plesk VPS backups:
- Use scheduled backups for recurring protection.
- Store important backups remotely.
- Use incremental backups when appropriate to reduce storage usage.
- Document what each backup includes.
- Test restoring a site or subscription before a real emergency.
How to Back Up and Restore a Windows VPS
A Windows VPS backup plan depends on whether you run IIS, SQL Server, custom Windows applications, file storage, RDP-based tools, or business software. Windows backups should include files, application settings, databases, system state when needed, and provider snapshots.
Windows VPS Backup Checklist
- Back up application folders.
- Back up IIS configuration if hosting websites.
- Back up SQL Server databases using database-aware tools.
- Back up user data and desktop files if the VPS is used through RDP.
- Export important certificates and license files.
- Use provider snapshots before major Windows updates.
- Store critical backups off-server.
Windows Server Backup can be useful for full server, volume, file, folder, and system state backup scenarios. For application-heavy servers, combine it with application-specific backup tools.
Backup Frequency: How Often Should You Back Up a VPS?
The right backup frequency depends on how often your data changes and how much data you can afford to lose. This is called the recovery point objective, or RPO.
| VPS Use Case | Suggested Backup Frequency | Reason |
|---|---|---|
| Static website | Weekly or after changes | Data changes slowly |
| Small WordPress site | Daily | Posts, comments, and uploads may change |
| Ecommerce store | Hourly to daily | Orders and customer data change often |
| SaaS application | Hourly or more frequent | Application data is business-critical |
| Game server | Daily or multiple times per day | Player progress changes frequently |
| Forex VPS | Before major changes and scheduled file backups | Trading settings and platform data matter |
| Business database | Frequent database-aware backups | Data loss may be costly |
If you are running critical workloads, also think about recovery time objective, or RTO. This means how quickly you need the service back online after failure. Snapshots may restore quickly, while manual rebuilds may take longer.
Where Should You Store VPS Backups?
Storing backups on the same VPS is better than having no backup, but it is not enough. If the VPS disk fails, the server is deleted, or malware encrypts the filesystem, local backups can be lost.
Better storage options include:
- Remote backup server: Good for rsync and SSH-based backups.
- Object storage: Good for scalable backup archives.
- NFS storage: Useful for private backup networks and server environments.
- Control panel remote backup destination: Useful for cPanel and Plesk users.
- Provider backup service: Convenient, but verify retention and restore options.
- Colocation storage: Useful for businesses with owned infrastructure.
If you plan to use network file storage, our guide to NFS server setup explains how NFS can work between Linux and Windows environments.
VPS Backup Security Best Practices
Backups often contain sensitive data. A leaked backup can expose databases, customer records, private keys, passwords, emails, and application secrets. Treat backups like production data.
- Encrypt sensitive backups: Use encryption when backups contain private or regulated data.
- Restrict access: Only trusted users and systems should access backup storage.
- Use SSH keys: Avoid password-based automation where possible.
- Separate backup credentials: Do not reuse production root credentials for backup storage.
- Limit backup user permissions: A backup user should only write to the needed backup path.
- Monitor failed backups: A silent backup failure can be worse than no backup plan because it creates false confidence.
- Protect database dumps: SQL dumps often contain the most sensitive data on the server.
- Rotate old backups: Keep enough restore points without keeping unnecessary sensitive copies forever.
How to Test VPS Backup Restoration
Testing is where many backup strategies fail. A backup file existing on disk does not prove you can recover from it. You need to perform test restores.
A good test restore process includes:
- Create a clean test VPS or temporary environment.
- Restore website files from backup.
- Restore databases from backup.
- Restore configuration files carefully.
- Update DNS or local hosts file for testing.
- Check website pages, login, forms, uploads, checkout, API calls, and cron jobs.
- Review logs for errors.
- Document the restore steps and time required.
Testing helps you find missing files, broken permissions, missing PHP extensions, incompatible OS versions, bad database credentials, or incomplete backups before a real outage.
If your restore process depends heavily on the operating system, read our guide to the Best Server OS before choosing your next VPS image.
Common VPS Backup Mistakes to Avoid
Only Backing Up Files
If your website or app uses a database, a file-only backup is incomplete. Always back up databases separately or use a tool that handles them properly.
Keeping Backups Only on the VPS
Local backups can disappear if the server is deleted, corrupted, suspended, or compromised. Store important backups off-server.
Never Testing Restores
Untested backups are risky. You may discover during an emergency that the backup is corrupt, incomplete, or too old.
Ignoring Permissions
After restoring Linux files, incorrect ownership and permissions can cause 403 errors, failed uploads, broken applications, or service failures.
Not Backing Up Configuration
Website files and databases are important, but configuration files are what make the service run correctly. Back up server configuration and document custom changes.
Using No Retention Plan
If you keep only one backup and it runs after malware infection or accidental deletion, you may overwrite your only clean copy. Keep multiple restore points.
Skipping Backup Monitoring
A cron job can fail for weeks if nobody checks it. Send logs, alerts, or status reports to a place you actually monitor.
Recommended VPS Backup Plan by Use Case
| Use Case | Recommended Backup Plan |
|---|---|
| Small website | Daily files and database backup, weekly snapshot, remote storage |
| WordPress site | Daily database and uploads backup, plugin/theme backup, off-server copy |
| Ecommerce store | Frequent database backups, daily full backup, tested restore process |
| Developer VPS | Git repository backup, config backup, database dumps, snapshot before changes |
| Game server | Frequent world saves, config backups, plugin/mod backups, remote copy |
| Forex VPS | Platform data backup, EA settings backup, snapshot before major changes |
| Business app | Database-aware backups, application files, configuration, monitoring, restore testing |
If your workload has outgrown simple VPS backups and needs stronger isolation, dedicated resources, or larger storage plans, compare VPS with our guide on what is dedicated server hosting.
VPS Backup Checklist
Use this checklist before you trust your backup setup:
- Important website or app files are included.
- Databases are backed up separately or consistently.
- Server configuration files are included.
- Backups are stored off-server.
- Backups are encrypted when needed.
- Old backups are rotated automatically.
- Backup jobs are logged.
- Backup failures trigger alerts or manual checks.
- At least one restore test has been completed.
- Restore instructions are documented.
- Provider snapshots are used before risky updates.
- Backup storage has enough space.
- Access to backup storage is restricted.
Conclusion
Learning how to back up and restore data on a VPS is not optional if your server hosts anything important. A VPS can run websites, databases, trading platforms, apps, email, game servers, and business tools, but every one of those workloads needs a recovery plan.
The best backup strategy combines multiple layers: provider snapshots for fast rollback, file-level backups for flexible recovery, database backups for dynamic content, control panel backups when available, and off-server storage for real disaster protection. Just as important, you should test your restore process before you need it.
If you only take one step today, make sure your backups are stored outside the VPS. If you take a second step, perform a test restore. Those two actions can save hours or days of downtime when something goes wrong.
FAQ
How do I back up data on a VPS?
You can back up VPS data using provider snapshots, file-level backups, database dumps, control panel backups, and off-server backup storage. A strong VPS backup strategy usually combines more than one method.
What is the best way to back up a Linux VPS?
The best way to back up a Linux VPS is to export databases, archive important files and configuration, then copy the backup to remote storage using a tool such as rsync over SSH. Provider snapshots are also useful before updates.
How do I restore a VPS backup?
To restore a VPS backup, reinstall or prepare the server, copy backup files back to the VPS, restore website files, import databases, restore configuration, check permissions, restart services, and test the application carefully.
Are VPS snapshots enough?
Snapshots are useful, but they should not be your only backup. They are best for short-term rollback. Important data should also be backed up to off-server storage.
How often should I back up my VPS?
Small websites may need daily backups, while ecommerce stores, SaaS apps, and databases may need hourly or more frequent backups. The right frequency depends on how much data you can afford to lose.
Should I store backups on the same VPS?
You can keep temporary local backups, but important backups should be stored off-server. If the VPS is deleted, corrupted, or compromised, local backups may be lost.
Can I back up a Windows VPS?
Yes. Windows VPS backups can include Windows Server Backup, provider snapshots, application backups, SQL Server backups, file backups, and off-server storage.
What is the difference between backup and snapshot?
A backup usually copies selected files, databases, or system data for later restoration. A snapshot is a point-in-time image of the server or disk, often used for fast rollback.
Do I need to back up databases separately?
Yes, in most cases. Dynamic websites and apps store critical data in databases, so database dumps or database-aware backups are needed.
How do I know if my VPS backup works?
The only reliable way is to test restore it. Create a test server, restore files and databases, check permissions, restart services, and confirm the website or application works.