HoganHost blog

How to Set Up Automatic Backups on a VPS

“I have a backup” often turns out to mean a single copy sitting on the same server as everything else. If that server fails, gets compromised, or someone runs the wrong command, that backup disappears right along with everything it was supposed to protect.
Automatic backups done properly follow one simple standard that has survived decades of technology changes for a reason.

Start With the 3-2-1 Rule.

This is the foundation every VPS owner should build on.
  • 3 copies of your data. Your live site counts as one, so you need at least two actual backups beyond that.
  • 2 different storage types. For example, your VPS disk plus a separate cloud storage service.
  • 1 copy off-site. At least one backup needs to live somewhere physically separate from your main server, ideally with a different provider entirely.
A copy sitting only on the VPS itself does not count as a real backup. Whatever takes down the server, whether that is a hack, a hardware failure, or a mistaken command, takes that copy down with it.

What Actually Needs Backing Up

Every VPS setup boils down to two things worth protecting.
  • Your files. Website files, uploaded media, configuration files, and anything a fresh server install would not automatically recreate.
  • Your databases. This is where WordPress, most CMS platforms, and most applications store their actual content and settings.
Databases need special handling. Copying a running database’s raw files often produces a backup that will not restore properly. Instead, use a proper database dump on a schedule, such as mysqldump for MySQL or MariaDB, which exports the data in a format that restores cleanly.

Setting Up Automatic Backups With cPanel and WHM

If your VPS runs cPanel and WHM, this is the more straightforward route.
  1. Log in to WHM with your root access.
  2. Navigate to the Backup Configuration section, usually found under Backup.
  3. Enable scheduled backups and set your preferred frequency, such as daily for active sites or weekly for lower traffic ones.
  4. Configure a remote destination, such as cloud object storage, so backups do not sit only on the same server they are protecting.
  5. Set a retention policy to automatically delete backups older than a set number of days, keeping storage costs manageable.
WHM’s built-in backup tools handle both files and database dumps automatically once configured correctly.

Setting Up Automatic Backups Without a Control Panel

For a bare Linux VPS without cPanel, cron jobs combined with command-line tools do the job well.
Using rsync for file backups, scheduled through a cron job:
rsync -avz /var/www/ user@backupserver:/home/backups/mysite/
Using tar to compress files before shipping them off-site:
tar -czf /backups/site-$(date +%F).tar.gz /var/www/
Dumping your database on a schedule:
mysqldump –single-transaction dbname > backup.sql
Combine these with a cron job to run automatically on a schedule, then use a tool like rclone to sync the resulting backup files to an off-site cloud storage destination.

A Sensible Backup Schedule

Not every website needs the same backup frequency.
  • Critical, frequently updated sites. Daily backups, or more often for high-transaction e-commerce sites.
  • Standard business websites. Daily to weekly backups usually cover the risk well.
  • Static or rarely updated content. Weekly to monthly backups are generally sufficient.

The Step Almost Everyone Skips

A backup that has never been tested is a hope, not a backup. At least twice a year, actually restore a file or a database dump into a separate test environment and confirm everything comes back intact, including file permissions and functionality.
Skipping this step means you only find out your backup was broken at the exact moment you needed it most.

Where a Managed VPS Makes This Easier

Setting all of this up correctly takes real technical comfort, and getting even one piece wrong, like forgetting the off-site copy, defeats the whole purpose. A VPS environment with built-in backup tools and full root access gives you the flexibility to configure this properly from day one.
Ready to set up a backup strategy that actually protects your business? HoganHost’s server hosting plans come with full root access and reliable infrastructure, giving you the control needed to build automatic backups the right way.

Leave a Comment

Your email address will not be published. Required fields are marked *