The Short Answer
Back up data and configuration, not the whole operating system. A fresh system can be installed in minutes; your databases, uploads, and settings cannot be recreated. The plan in this guide:
- Dump every database to a file.
- Copy configuration, site files, and the dumps to another machine with a tool that keeps versions.
- Keep at least one copy off the server and away from its provider account.
- Schedule it, and test a restore.
What to Back Up
- Configuration:
/etc, which includes web server, SSH, and certificate files. - Sites and application data:
/var/www,/srv, or wherever your applications live. - Home folders:
/homeand/root, including scripts and SSH keys. - Scheduled jobs: user crontabs under
/var/spool/cron. - Database dumps: not the raw files in
/var/lib/mysqlor/var/lib/postgresql; copying those while the database runs gives an inconsistent copy. - Docker volumes: application data in volumes; databases inside containers are dumped like any other database.
Leave out /proc, /sys, /dev, /run, /tmp, and cache folders.
Step 1: Dump the Databases
Write dumps to a staging folder such as /var/backups, then let the file backup pick them up. MySQL and MariaDB are covered in how to back up MySQL with mysqldump, PostgreSQL in how to back up PostgreSQL with pg_
Step 2: Record the Installed Packages
# Debian and Ubuntu
apt-mark showmanual | sudo tee /var/backups/packages.txt
# AlmaLinux and Rocky Linux
rpm -qa | sort | sudo tee /var/backups/packages.txtWith this list and /etc, a new server can be rebuilt to match the old one.
Step 3: Copy to Another Host
The plainest method is rsync to a second server. --delete removes files on the backup side that are gone from the server, so run it with -n (dry run) first and read the list:
sudo rsync -aAXhn --delete /etc /home /root /var/www /var/backups user@your_server_ip:/srv/backups/web1/
sudo rsync -aAXh --delete /etc /home /root /var/www /var/backups user@your_server_ip:/srv/backups/web1/-A and -X keep ACLs and extended attributes. That gives one copy, overwritten each night. To go back to last Tuesday, you need versions: BorgBackup and restic keep many dated versions, deduplicated and encrypted. The general rsync options are in the rsync command guide.
Where the Copies Live
| Copy | Protects against |
|---|---|
| Snapshot at your provider | A bad update, undone quickly |
| Backup on another server | Loss of this server or its disk |
| Copy off the provider | Loss of the account or the whole site |
A copy on the same disk is not a backup, and RAID is not one either: it survives a failed drive, not a deleted file. A snapshot at the same provider is one useful layer, not the off-site copy; see snapshot vs backup and the 3-2-1 backup rule.
Step 4: Schedule It
Run the dumps first and the copy after them, every night, from a script. A cron job or a systemd timer both work; see how to create a cron job. Send the output to a log and read it, or have the job alert you when it fails.
Step 5: Test the Restore
- Restore a folder to a scratch directory, such as
/tmp/restore-test, never over the live files. - Compare it with the original:
diff -r /tmp/restore-test/etc/nginx /etc/nginx. - Import the newest database dump into a scratch database and count its tables and rows.
- Note how long the restore took. That is your real recovery time.
Repeat this every month and after every change to the backup setup.
Protect the Backups Themselves
- Separate credentials: if the server is broken into, its keys should not be able to delete old backups. Pull backups from the backup host, or use an append-only repository.
- Encryption: encrypt copies that leave your control. Keep the passphrase somewhere other than the server: losing it means losing the backups.
Updated:
Linux VPS with Full Root Access
MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.
More Guides
No Limits on Service or Support
You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

- 100% customer satisfaction goal
- Our own hardware
- 24/7 ticket and email support
- 4 countries with locations