Skip to main content
To back up a Linux server, copy your configuration (/etc), your data (/home, /var/www, /srv, /root) and a fresh database dump to storage that is not on the same server. Use rsync for a plain copy to another server, restic for encrypted versioned backups, or rclone for cloud storage. Run it daily from cron and test a restore.

Before you start

  • Connect with SSH as a user with sudo. Root users can leave out sudo.
  • Decide where backups go: another server, object storage (S3-compatible), or your own computer. A backup that lives only on the same disk disappears with that disk.
  • On a VPS, you can also take full-disk backups in the panel. See VPS Panel backups. File-level backups below are a second, independent copy you control.

What should I back up on a Linux server?

You do not need /proc, /sys, /dev, /run, /tmp or package caches. They are created at boot or can be downloaded again.

What is the 3-2-1 backup rule?

Keep 3 copies of your data, on 2 different types of storage, with 1 copy off-site. For a server that usually means: the live data, a panel or snapshot backup, and an off-server copy (another server or cloud storage) that the server itself cannot delete.

Which backup tool should I use?

If you are unsure, start with restic: it encrypts, keeps old versions and only uploads changes.

How to make a simple backup with tar

This makes one compressed archive. It is a good first step, but copy the file off the server afterwards.
1

Create a backup folder

2

Dump your databases

For MariaDB or MySQL:
sudo tee writes the file as root, because /backup belongs to root. See back up MySQL databases for details and PostgreSQL.
3

Save the package list and crontab

4

Create the archive

-p keeps file permissions. $(date +%F) adds today’s date, for example server-2026-11-04.tar.gz. tar prints Removing leading '/' from member names; this is normal.
5

Protect the archive

The archive holds passwords and keys from /etc and your database. Make it readable only by your user, so you can download it:
6

Copy it off the server

From your own computer:
See copy files with scp and rsync.
A backup file stored on /backup of the same server is lost if the disk fails, the server is rebuilt or an attacker deletes it. Always keep a copy somewhere else.

How to run backups automatically

Put your backup commands in a script, for example /usr/local/bin/backup.sh, make it executable with sudo chmod 700 /usr/local/bin/backup.sh, then add it to root’s crontab with sudo crontab -e:
In a crontab line, % has a special meaning. If you put date +%F directly in the crontab instead of in a script, write it as date +\%F. See schedule tasks with cron.

How to check your backups work

A backup you have never restored is a guess. Once a month:
  1. Restore one folder to a temporary location, for example /tmp/restore-test.
  2. Open a few files and compare them with the live ones.
  3. Import a database dump into a test database.
  4. Check the backup log for errors and the date of the last successful run.

Frequently asked questions

How often should I back up my server?

Back up at least daily for anything that changes, such as websites, databases and game worlds. Configuration can be backed up less often, but backing it up with the rest costs very little.

Are VPS panel backups enough?

They are a useful full-disk copy, but they are one copy in one place. Keep at least one more copy that you control, off the server. See VPS Panel backups for what the panel backs up.

Can I back up a running database by copying its files?

Not safely. Files copied while the database is writing can be inconsistent. Use mysqldump/mariadb-dump or pg_dump, then back up the dump file.

Is RAID a backup?

No. RAID keeps a server running when a disk fails, but it copies deletions and corruption to every disk instantly. See software RAID with mdadm.

How do I back up a Windows server?

Use Windows Server Backup or a third-party tool. See back up a Windows server.

VPS and dedicated server guides

Every guide in this section.

Encrypted backups with restic

Versioned, encrypted, deduplicated.

Back up with rsync

Copy to another server over SSH.

Back up to cloud storage

S3, Google Drive and more with rclone.

Back up MySQL databases

Dump and restore your databases.

VPS Panel backups

Full-disk backups and restores.

Checked against the official Ubuntu Server backup documentation on 4 November 2026; tar, dpkg --get-selections and the folder list tested on Ubuntu 24.04 LTS. Commands can differ on other distributions or releases.

Need Extra Help?

If you encounter any issues, our support team is ready to assist:

Save on Your Hosting

Ready to upgrade your hosting? Use code KB20 at checkout for 20% off your first order!

Last Updated: November 2026