How to Back Up Your Linux System
Learn how to back up your Linux system using Timeshift, rsync, Borg, and Restic — then tie it all together with a practical 3-2-1 backup routine.
Before you start
- ▸sudo / root access on the machine you want to back up
- ▸An external drive or remote server to store backups
- ▸SSH key authentication configured if using remote rsync or Borg over SSH
- ▸Basic comfort running commands in a terminal
A backup you haven't tested is a wish, not a plan. Linux gives you several solid tools — Timeshift for system snapshots, rsync for straightforward file copies, and Borg or Restic for deduplicated, encrypted archives. This guide covers all three, explains when to use each, and ends with a practical 3-2-1 routine you can set up today.
Understanding What You're Protecting
Before picking a tool, decide what you're backing up:
- System snapshots — the OS, installed packages, and configuration files under
/etc. Timeshift excels here. - Home directory / user data — documents, photos, code, mail. rsync, Borg, or Restic are better fits.
- Full-machine disaster recovery — everything, ideally off-site and encrypted. Borg or Restic with a remote target.
A complete strategy covers all three layers. The 3-2-1 rule — 3 copies, on 2 different media, 1 off-site — ties them together at the end of this guide.
Option 1: Timeshift for System Snapshots
Timeshift takes incremental snapshots of your root filesystem using either rsync or BTRFS subvolumes. It is designed for system restore, not personal file backup. If you use BTRFS, prefer the BTRFS mode; on ext4, use rsync mode.
Install Timeshift
# Debian / Ubuntu
sudo apt install timeshift
# Fedora (copr)
sudo dnf install timeshift
# Arch (AUR)
paru -S timeshift
Create a Snapshot from the CLI
sudo timeshift --create --comments "before system upgrade" --tags D
Tags control retention: O (OnDemand), D (Daily), W (Weekly), M (Monthly). List snapshots with:
sudo timeshift --list
Restore a Snapshot
sudo timeshift --restore --snapshot '2024-06-01_10-00-01'
You can also restore from a live USB if the system won't boot — install Timeshift on the live environment and point it at the backup drive.
Automate with systemd
Timeshift ships its own scheduler, but you can also run it from a systemd timer. Enable the built-in scheduler in the GUI or via:
sudo timeshift --create --scripted
Add that command to a systemd timer unit if you want fine-grained control over the schedule.
Option 2: rsync for File-Level Backups
rsync copies files efficiently by transferring only changed blocks. It's universally available, scriptable, and produces a plain directory you can browse without special tools.
Basic Local Backup
rsync -aAXv --delete \
--exclude='/home/*/.cache' \
/home/username/ \
/mnt/backup-drive/home-username/
-a— archive mode (preserves permissions, symlinks, timestamps)-AX— preserve ACLs and extended attributes--delete— remove files from the destination that no longer exist in the source
Backup to a Remote Host
rsync -aAXv --delete \
/home/username/ \
user@remote-server:/backups/home-username/
Set up SSH key authentication first so this can run unattended. rsync over SSH is encrypted in transit.
Automate with a systemd Timer
Create the service unit:
sudo nano /etc/systemd/system/rsync-backup.service
[Unit]
Description=rsync home directory backup
[Service]
Type=oneshot
User=username
ExecStart=/usr/bin/rsync -aAXq --delete \
/home/username/ \
/mnt/backup-drive/home-username/
Create the timer unit:
sudo nano /etc/systemd/system/rsync-backup.timer
[Unit]
Description=Run rsync backup daily
[Timer]
OnCalendar=daily
Persistent=true
[Install]
WantedBy=timers.target
sudo systemctl daemon-reload
sudo systemctl enable --now rsync-backup.timer
Option 3: Borg and Restic for Encrypted, Deduplicated Backups
Both tools compress and deduplicate data before storing it, and both encrypt archives at rest. They're the right choice for off-site or cloud backups where storage efficiency and confidentiality matter.
Restic Quick Start
Restic's syntax is simpler and it supports more backends out of the box (local, SFTP, S3, Backblaze B2, Rclone).
# Install
sudo apt install restic # Debian/Ubuntu
sudo dnf install restic # Fedora
sudo pacman -S restic # Arch
# Initialize a repository (local example)
restic init --repo /mnt/backup-drive/restic-repo
# Back up your home directory
restic -r /mnt/backup-drive/restic-repo backup \
--exclude="$HOME/.cache" \
$HOME
# List snapshots
restic -r /mnt/backup-drive/restic-repo snapshots
# Restore a snapshot
restic -r /mnt/backup-drive/restic-repo restore latest \
--target /tmp/restore-test
Restic prompts for a passphrase on init. Store that passphrase somewhere safe — without it, the repository is unrecoverable. You can pass it via the RESTIC_PASSWORD environment variable or a password file for automation.
Borg Quick Start
BorgBackup is mature, widely packaged, and integrates well with Borgmatic for automated, config-file-driven backups.
# Install
sudo apt install borgbackup # Debian/Ubuntu
sudo dnf install borgbackup # Fedora
sudo pacman -S borg # Arch
# Initialize a repository
borg init --encryption=repokey /mnt/backup-drive/borg-repo
# Create an archive
borg create --stats --progress \
/mnt/backup-drive/borg-repo::'{hostname}-{now:%Y-%m-%d}' \
$HOME \
--exclude $HOME/.cache
# Prune old archives (keep 7 daily, 4 weekly, 6 monthly)
borg prune --list \
--keep-daily=7 --keep-weekly=4 --keep-monthly=6 \
/mnt/backup-drive/borg-repo
# List archives
borg list /mnt/backup-drive/borg-repo
The 3-2-1 Backup Routine in Practice
The 3-2-1 rule originated in photography but applies directly to system administration:
- 3 copies of your data (the live copy counts as one)
- 2 different media — e.g., internal SSD and external USB drive
- 1 off-site copy — a remote server, or a cloud storage provider via Restic or Borg
A concrete routine for a typical workstation:
- Daily Timeshift snapshot to a second internal partition or external drive — protects against bad updates and configuration mistakes.
- Daily rsync or Restic backup of
/hometo an external USB drive — your files, versioned and browsable. - Weekly Restic or Borg backup to a remote target (your own VPS, Hetzner Storage Box, or Backblaze B2) — the off-site copy that survives fire, theft, or drive failure.
Use systemd timers (shown above for rsync) for steps 1 and 2, and a separate timer or a cron job for the weekly off-site push.
Verifying Your Backups
A backup is only real if you can restore from it. Run these checks regularly — at minimum monthly.
# Restic: check repository integrity
restic -r /mnt/backup-drive/restic-repo check
# Restic: verify a sample of actual data blocks
restic -r /mnt/backup-drive/restic-repo check --read-data-subset=10%
# Borg: check consistency
borg check /mnt/backup-drive/borg-repo
# Test a real restore
restic -r /mnt/backup-drive/restic-repo restore latest \
--include "$HOME/Documents/important-file.txt" \
--target /tmp/verify-restore
Then open /tmp/verify-restore and confirm the file is intact. This takes two minutes and has saved countless administrators from discovering their backups were corrupt only during a crisis.
Troubleshooting
- Timeshift says no space on device — check that the target partition has enough room (
df -h) and reduce the number of retained snapshots in Timeshift settings. - rsync permission errors — run as root for system directories, or use
--rsync-path="sudo rsync"for remote targets. Avoid running rsync as root over the network unnecessarily. - Restic backup is slow on first run — expected. Subsequent runs are fast because only changed chunks are stored.
- Lost Borg or Restic passphrase — the repository is permanently unrecoverable without it. Store passphrases in a password manager and a printed emergency sheet stored off-site.
- systemd timer not running — check with
systemctl list-timersand inspect logs withjournalctl -u rsync-backup.service.
Frequently asked questions
- Should I use Timeshift to back up my home directory?
- No. Timeshift is designed for system restoration — it excludes /home by default and isn't built for versioning personal files. Use rsync, Restic, or Borg for your home directory.
- What's the difference between Borg and Restic?
- Both deduplicate and encrypt. Restic has a simpler CLI and native support for more cloud backends. Borg is older, very mature, and pairs well with Borgmatic for config-driven automation. Either is a solid choice.
- How much storage do I need for backups?
- Plan for at least 2-3x your data size for local backups with several versions. Deduplication in Borg and Restic can reduce this significantly for incremental backups over time.
- Can I back up to a cloud provider without a VPS?
- Yes. Restic supports Backblaze B2, Amazon S3, and any rclone-compatible target directly. Borg can reach cloud storage via Borgbase or through rclone as a FUSE mount.
- How do I back up my system if it won't boot?
- Boot from a live USB, install your backup tool in the live environment, mount the backup drive, and run a restore. Timeshift snapshots are accessible this way; Restic and Borg repositories can also be mounted or restored from a live session.
Related guides
How to Choose a Linux Distribution
Match a Linux distro to your real needs — desktop, server, rolling vs LTS, hardware quirks, and package ecosystems — without wading through marketing noise.
How to Dual-Boot Linux and Windows
Shrink the Windows partition, install Linux without breaking the bootloader, configure GRUB, and handle Secure Boot — all in the correct order.
10 Things to Do After Installing Linux
Ten essential post-install steps for any Linux desktop: updates, drivers, firewall, codecs, backups, SSH hardening, and service cleanup — all with modern commands.
How to Download and Install Linux
Choose a Linux distro, download and verify the ISO, write it to USB with dd or Etcher, then boot and run the graphical installer — covered step by step.