Data loss is one of the most painful experiences in computing. A hard drive that fails without warning, an accidental rm -rf in the wrong directory, a failed system update that leaves the OS unbootable — these events happen, even to careful users. The only defense is a reliable backup strategy set up before disaster strikes.
Linux has excellent backup tools. This guide covers three: Timeshift for system snapshots, rsync for file backups, and BorgBackup for automated, encrypted, space-efficient backups.
Why you need backups
The question is not whether you will lose data — it is when. Hard drives and SSDs have a finite lifespan. SSDs are particularly vulnerable to sudden failure with no warning signs. Human error is an equally common cause: a mistyped command, a confused delete, a corrupted file.
Backups also protect against software failures. After a major system update, some systems refuse to boot. Without a snapshot, restoring a working system requires a complete reinstall.
The most important insight about backups: a backup you have not tested is not a backup. Storage media can fail silently. Backup jobs can stop running unnoticed. Always verify your backups restore correctly.
The 3-2-1 rule
The 3-2-1 rule is the most widely recommended backup strategy:
- 3 copies of your data
- 2 different types of storage media
- 1 copy stored offsite (not in your home or office)
For a Linux desktop user, this might look like:
- Original files on your computer’s SSD
- A copy on an external USB hard drive in your home
- A copy in cloud storage (Backblaze B2, S3, or similar)
This strategy protects against every common failure scenario: drive failure (copy 2 and 3 survive), theft or fire (copy 3 survives), and cloud service issues (copies 1 and 2 survive).
Timeshift — system snapshots made easy
Timeshift creates snapshots of your entire Linux system using either rsync or BTRFS filesystem snapshots. It is designed specifically to protect your operating system, not your personal files.
Think of Timeshift snapshots like Windows System Restore — a saved system state you can roll back to if an update or software installation breaks something.
Install Timeshift:
sudo apt install timeshift
Open Timeshift from your application menu (it requires graphical access). The first-time wizard asks:
- Snapshot type: Choose RSYNC (works on any filesystem) or BTRFS (faster, requires BTRFS filesystem)
- Snapshot location: Choose which drive to save snapshots to (preferably a separate drive from your system drive)
- Schedule: How often to create automatic snapshots
Recommended schedule for a desktop:
- Monthly: keep 2 snapshots
- Weekly: keep 3 snapshots
- Daily: keep 5 snapshots
- Boot: keep 3 snapshots (create a snapshot at each boot — useful to catch regressions)
Create a snapshot manually before any major system change:
sudo timeshift --create --comments "Before kernel upgrade"
List available snapshots:
sudo timeshift --list
Restore a snapshot:
If your system is still bootable, open Timeshift and click Restore on the desired snapshot. If your system is broken and unbootable, boot from a Linux USB, install Timeshift on the live system, and restore from there.
Timeshift is an essential safety net for Linux desktop users. A few megabytes of snapshot data have saved countless hours of system recovery.
rsync — the versatile backup tool
rsync is a command-line tool that efficiently copies files and directories between locations. It only transfers files that have changed since the last sync, making repeated backups fast even for large collections.
rsync is installed by default on most Linux systems. If not:
sudo apt install rsync
Basic syntax:
rsync -av source/ destination/
The -a flag (archive) preserves file permissions, timestamps, symbolic links, and ownership. The -v flag (verbose) shows what is being copied.
Backup your home directory to an external drive:
rsync -av --progress /home/alice/ /media/alice/backup-drive/home-backup/
Add --delete to mirror the source exactly (removes files from the destination that no longer exist in the source):
rsync -av --delete /home/alice/ /media/alice/backup-drive/home-backup/
Warning: --delete means if you accidentally delete a file from your computer, the next rsync run will also delete it from your backup. Without --delete, your backup keeps a copy of deleted files — which is useful for recovery but eventually wastes space.
Backup to a remote server over SSH:
rsync -av /home/alice/Documents/ username@server-ip:/backups/alice-documents/
rsync uses SSH by default for remote transfers, so it is encrypted.
Exclude directories from backup:
rsync -av --exclude='Downloads/' --exclude='.cache/' /home/alice/ /media/backup/
Dry run (show what would be copied without actually copying):
rsync -av --dry-run /home/alice/ /media/backup/
Always do a dry run when testing a new rsync command to confirm it will do what you expect.
BorgBackup — encrypted and deduplicated
BorgBackup (often called “Borg”) takes backup to the next level with three key features:
Deduplication: Borg identifies chunks of data that appear in multiple files or backup versions and stores them only once. This makes backups dramatically smaller, especially when you have many similar files or keep many old versions.
Encryption: Every backup is encrypted using AES-256 before being stored. This makes Borg suitable for cloud backups — even if someone gains access to your cloud storage, they cannot read your backup data.
Versioning: Borg keeps complete, independent, point-in-time snapshots. Delete a file by mistake? Restore it from yesterday’s snapshot. The deduplication means keeping sixty days of daily backups often takes only modestly more space than one full backup.
Install BorgBackup:
sudo apt install borgbackup
Initialize a new repository:
borg init --encryption=repokey /media/alice/backup-drive/borg-repo
Enter a passphrase when prompted. Store this passphrase somewhere safe — without it, you cannot decrypt your backups.
Create a backup archive:
borg create /media/alice/backup-drive/borg-repo::backup-2026-04-01 /home/alice/
The ::backup-2026-04-01 part is the archive name (snapshot name) within the repository. You can use any naming convention.
List all archives in the repository:
borg list /media/alice/backup-drive/borg-repo
Show the contents of a specific archive:
borg list /media/alice/backup-drive/borg-repo::backup-2026-04-01
Restore files from a backup:
cd /tmp/restore
borg extract /media/alice/backup-drive/borg-repo::backup-2026-04-01 home/alice/Documents/
Delete old archives:
borg delete /media/alice/backup-drive/borg-repo::backup-2026-01-01
Prune old archives automatically (keep daily for 7 days, weekly for 4 weeks, monthly for 12 months):
borg prune /media/alice/backup-drive/borg-repo \
--keep-daily=7 \
--keep-weekly=4 \
--keep-monthly=12
Automating backups with cron
Manual backups are better than no backups, but automated backups are better than manual. Use cron to schedule your backup scripts to run automatically.
Create a backup script:
nano ~/scripts/backup.sh
#!/bin/bash
REPO=/media/alice/backup-drive/borg-repo
export BORG_PASSPHRASE="your-passphrase-here"
borg create \
--stats \
--exclude ~/.cache \
--exclude ~/.local/share/Trash \
$REPO::backup-$(date +%Y-%m-%d) \
/home/alice/
borg prune \
--keep-daily=7 \
--keep-weekly=4 \
--keep-monthly=12 \
$REPO
unset BORG_PASSPHRASE
Make it executable:
chmod +x ~/scripts/backup.sh
Schedule with cron:
crontab -e
Add a line to run the backup every day at 2 AM:
0 2 * * * /home/alice/scripts/backup.sh >> /var/log/backup.log 2>&1
The >> /var/log/backup.log 2>&1 part saves all output and errors to a log file, so you can verify the backup ran correctly.
Cloud backup options
Local backups protect against drive failure and accidental deletion. Offsite backups (the “1” in the 3-2-1 rule) protect against theft, fire, and other physical disasters.
For keeping your files safe both locally and in the cloud, the combination of local rsync backups and an offsite encrypted copy with BorgBackup or rclone provides comprehensive protection. For a simpler approach to document backup that works across all platforms, jesauvegardemesdocuments.com offers practical advice on keeping your files safe both locally and in the cloud.
rclone is the standard Linux tool for syncing to cloud storage. It supports over forty cloud providers:
sudo apt install rclone
rclone config # interactive configuration wizard
rclone sync /home/alice/Documents remote:my-backup/documents
After configuring a remote with rclone config, you can sync any local directory to your cloud storage. Combine with cron for automatic daily cloud sync.
Backblaze B2 is a popular affordable cloud storage for Linux backups. At around $6/TB/month, it is much cheaper than consumer cloud storage for large amounts of data.
Testing your backups
A backup you have never tested is a liability, not an asset. At minimum, test your backup strategy quarterly:
- Restore a random file from your backup and verify its contents are correct
- For Borg repositories, run
borg checkto verify data integrity:
borg check /media/alice/backup-drive/borg-repo
- Practice a full restore in a test environment (a spare computer or a virtual machine)
Testing backups feels like unnecessary extra work until the moment you need to restore — at which point it becomes the most important thing you ever did.
Recovering from a disaster
If your system drive fails or becomes corrupted:
- Boot from a Linux USB drive (live mode)
- Connect your backup drive
- Mount the backup drive and restore your files:
sudo mount /dev/sdb1 /mnt/backup
sudo mount /dev/sdc1 /mnt/restore-target
# For rsync-based backup:
rsync -av /mnt/backup/home-backup/ /mnt/restore-target/home/
# For Borg:
export BORG_PASSPHRASE="your-passphrase"
borg extract /mnt/backup/borg-repo::latest-archive /home/alice/
- Reinstall Linux on your new drive
- Restore your home directory from backup
The combination of Timeshift (for system recovery) and BorgBackup (for file recovery) means you can recover from almost any data loss scenario in a predictable, reliable way.