Backing Up Your Linux System
Hard drives die. Files get accidentally deleted. Updates occasionally go sideways. Backups are the seatbelt you never think about -- until you really, really need one.
Why backups matter
Let's get the uncomfortable talk out of the way: "It won't happen to me" is what everyone says right up until it happens to them.
Here are some completely normal things that can ruin your day:
- Your hard drive fails. They all do eventually -- SSDs included. It's not a matter of if, it's when.
- You accidentally delete an important folder. One wrong command, one misclick, and it's gone.
- A system update breaks something. Rare on Linux, but it can happen -- especially if you're on a rolling release distro.
- You mess up a config file and can't boot anymore. It happens to the best of us.
- Ransomware or malware. Extremely rare on Linux, but not impossible.
Backups take a few minutes to set up and then they run on their own. Without them, you're one bad day away from losing everything -- photos, documents, projects, the whole lot.
Two kinds of backups
Before we dive in, let's clear up the two main approaches. You don't have to choose just one -- in fact, using both is ideal.
1. Full system snapshots
This saves everything -- your operating system, your apps, your settings, all of it. If your system breaks, you can roll back to exactly how it was before. Think of it like System Restore on Windows, but better.
Best for: Recovering from broken updates, bad configs, or system-level mistakes.
Tool: Timeshift (covered below).
2. Personal file backups
This saves your stuff -- documents, photos, music, videos, project files. The things that are actually irreplaceable. If your hard drive dies, your system can be reinstalled in 20 minutes, but your family photos are gone forever without a backup.
Best for: Protecting against hardware failure, accidental deletion, or theft.
Tools: rsync, Deja Dup, simple file copy (all covered below).
Timeshift -- the easiest system backup
If you've ever used System Restore on Windows, Timeshift is basically that, but more reliable. It takes a snapshot of your entire system at a point in time. If an update breaks something or you mess up a config, you just roll back to the last good snapshot. Done.
Timeshift comes pre-installed on Linux Mint. On other distros, you'll need to install it.
Installing Timeshift
Open a terminal and run the command for your distro:
# Ubuntu, Mint, Pop!_OS, and other Debian-based distros
sudo apt install timeshift
# Fedora
sudo dnf install timeshift
# Arch, Manjaro, EndeavourOS
sudo pacman -S timeshift
Setting up automatic snapshots
- Open Timeshift from your app menu (it'll ask for your password since it works with system files).
- Choose RSYNC as the snapshot type. (The other option, BTRFS, is only for systems using the Btrfs filesystem. If you don't know what that is, pick RSYNC.)
- Pick the drive where snapshots will be stored. Your main drive works fine, but an external or second internal drive is even better.
- Set a schedule. A good starting point:
- Monthly: keep 2
- Weekly: keep 3
- Daily: keep 5
- On the Users tab, leave everything at the default. Timeshift is for system files, not personal files (we'll cover personal file backups next).
- Click Finish. Timeshift will automatically create snapshots on your chosen schedule.
Restoring from a Timeshift snapshot
If something breaks, restoring is straightforward:
- Open Timeshift.
- Select the snapshot you want to restore to (pick one from before things went wrong).
- Click Restore.
- Review what will be changed and confirm.
- Wait for it to finish, then reboot.
Your system will be back to the state it was in when that snapshot was taken. Your personal files in /home are not affected by default -- only system files get rolled back.
What if I can't even boot into my system to open Timeshift?
No worries -- you can restore from a live USB. See the "Emergency restore" section at the bottom of this page.
Backing up your personal files
Timeshift handles your system. Now let's protect the stuff you actually care about: your documents, photos, music, projects, and anything else in your home folder.
There are a few ways to do this, from dead simple to slightly more advanced.
Option 1: Just copy them
The simplest backup in the world: plug in an external drive and copy your files to it.
- Plug in a USB drive or external hard drive.
- Open your file manager.
- Copy your Documents, Pictures, Music, Videos, and any other important folders to the external drive.
- Done.
The downside? You have to remember to do this regularly. And every time, it copies everything again, even files that haven't changed. That's slow if you have a lot of data.
For something smarter, use rsync.
Option 2: rsync -- one command to sync your files
rsync is a command-line tool that copies files intelligently. It only copies what's changed since last time, so after the first backup, it's fast. It comes pre-installed on almost every Linux distro.
Here's the one command you need:
rsync -av --delete /home/yourname/ /media/yourname/BackupDrive/home-backup/
Let's break that down:
rsync-- the backup command-av-- archive mode (preserves permissions, dates, etc.) and verbose (shows what it's doing)--delete-- removes files from the backup that you've deleted from your computer, so the backup stays a mirror/home/yourname/-- what you're backing up (the trailing slash matters!)/media/yourname/BackupDrive/home-backup/-- where to put the backup (your external drive)
Run this command whenever you want to back up. The first time takes a while. After that, it only copies new or changed files, so it's quick.
How do I make rsync run automatically?
You can set up a cron job (a scheduled task) to run rsync on a timer. Open a terminal and type:
crontab -e
Add this line at the bottom to back up every day at 2 AM:
0 2 * * * rsync -a --delete /home/yourname/ /media/yourname/BackupDrive/home-backup/
Save and close. The backup will run silently in the background every day (as long as the external drive is plugged in).
Option 3: Deja Dup -- graphical backup tool
If you'd rather not touch the terminal, Deja Dup (also called "Backups") is a friendly graphical tool. It's built into Ubuntu and some other distros. If you don't have it:
# Ubuntu, Mint, Pop!_OS
sudo apt install deja-dup
# Fedora
sudo dnf install deja-dup
Setting it up:
- Open Backups from your app menu.
- Choose what to back up. Your home folder is selected by default, which is usually what you want.
- Choose what to ignore. The Trash and Downloads folders are excluded by default -- you can add more if you want.
- Choose where to store your backup. Pick your external drive, a network drive, or even Google Drive.
- Turn on Automatic Backups and pick how often (daily or weekly).
- Click Back Up Now to run your first backup.
To restore files later, just open Deja Dup and click Restore. You can restore everything or pick specific files and folders.
Cloud backup options
An external drive is great, but what if your house floods or your laptop gets stolen? Having a copy somewhere else -- "offsite" -- protects you from the really bad scenarios. Here are a few options:
- Nextcloud -- A self-hosted cloud you run on your own hardware or a rented server. It's like having your own personal Google Drive, completely private. Great if you're a bit technical or have a home server.
- Syncthing -- Syncs files between your devices directly, no cloud server needed. If you have two computers, Syncthing can keep a folder in sync between them automatically. Free, open source, and very easy to set up.
- rclone -- A command-line tool that can sync your files to pretty much any cloud provider: Google Drive, Dropbox, OneDrive, Backblaze B2, and dozens more. Think of it as rsync but for the cloud. Very powerful if you're comfortable with the terminal.
The 3-2-1 rule
This is the golden rule of backups, used by professionals everywhere. It's simple:
- 3 copies of your data (the original plus two backups)
- 2 different types of storage (like your computer's hard drive and an external drive)
- 1 copy offsite (somewhere physically different -- a cloud service, a drive at a friend's house, anything that's not in the same building)
That sounds like a lot, but in practice it might look like this:
- Your files on your computer (copy 1)
- An rsync backup to an external hard drive on your desk (copy 2, different storage)
- Syncthing syncing to a computer at your office, or rclone to a cloud service (copy 3, offsite)
Even if you just manage two of these, you're already way ahead of most people. Don't let perfect be the enemy of good -- any backup is infinitely better than no backup.
What to back up (and what you can skip)
Definitely back up
~/Documents-- your personal documents~/Picturesand~/Videos-- irreplaceable photos and videos~/Music-- if you have a local music collection~/Projectsor~/Code-- your work and projects~/.ssh-- your SSH keys (losing these is a pain)~/.gnupg-- your GPG keys if you use encryption- Any hidden config folders for apps you've customized (like
~/.config) - Browser bookmarks (usually in your browser's sync or in
~/.config)
You can probably skip
~/Downloads-- usually stuff you can re-download~/.cache-- temporary files that apps will recreate~/.local/share/Trash-- it's trash, literally- Steam games and other large apps you can reinstall
- Virtual machine disk images (unless you can't rebuild them)
dpkg --get-selections > my-apps.txt. On Fedora: dnf list installed > my-apps.txt. Save that file with your backups -- it makes reinstalling everything much faster.
Emergency restore: when everything goes wrong
Worst case scenario: your system won't boot at all. Maybe an update bricked things, maybe a drive is failing. Here's how you get back on your feet.
Restoring a Timeshift snapshot from a live USB
If you can't boot into your system, you can restore a Timeshift snapshot using a live USB. Here's how:
- Boot from a live USB. Use the same distro's live USB that you have installed (for example, a Linux Mint USB if you're running Mint). See our installation guide if you need help creating one.
- Install Timeshift on the live session (it won't be there by default on most distros):
sudo apt install timeshift - Open Timeshift. It will detect your existing snapshots on your hard drive automatically.
- Select the snapshot you want to restore and click Restore.
- Wait for it to finish, then remove the USB and reboot.
Your system should be back to the state it was in when that snapshot was taken.
Restoring personal files from an rsync backup
If you've reinstalled your system from scratch and want to bring your files back from an rsync backup:
- Plug in the external drive with your backup.
- Open a terminal.
- Copy your files back:
rsync -av /media/yourname/BackupDrive/home-backup/ /home/yourname/ - That's it. Your documents, photos, configs, and everything else will be back where they were.
If you only want to restore specific folders, just adjust the paths:
rsync -av /media/yourname/BackupDrive/home-backup/Documents/ /home/yourname/Documents/
Full disaster recovery: mounting your drive and copying files manually
If your system is completely toast but the hard drive still works, you can pull files off it using a live USB:
- Boot from a live USB.
- Find your drive. Open a terminal and run:
lsblkLook for your main drive (usually something like
sda1ornvme0n1p2). The size should help you identify the right one. - Mount the drive:
sudo mkdir /mnt/recovery sudo mount /dev/sda2 /mnt/recovery(Replace
sda2with your actual partition from the previous step.) - Copy your files to an external drive:
cp -r /mnt/recovery/home/yourname/Documents /media/yourname/ExternalDrive/ cp -r /mnt/recovery/home/yourname/Pictures /media/yourname/ExternalDrive/Repeat for any folders you want to save.
- Unmount and reinstall:
sudo umount /mnt/recoveryNow you can reinstall your distro fresh and copy the files back from the external drive.
Quick-start checklist
Don't overthink it. Here's the simplest path to being protected:
- Install Timeshift and set up automatic weekly snapshots. (10 minutes)
- Get an external drive and set up rsync or Deja Dup to back up your home folder. (15 minutes)
- If you want offsite backup, set up Syncthing to another device or rclone to a cloud service. (30 minutes)
That's it. Less than an hour of setup, and you never have to worry about losing your files again.