Info2soft use cookies to help you have a superior and more admissible browsing experience on our website. Privacy Policy
Loading...
Losing data on Ubuntu can happen without warning — a failed drive, an accidental deletion, or a system upgrade that doesn’t go as planned.
This guide covers four backup methods for Ubuntu Linux, from simple desktop tools to command-line utilities built for servers.
Before picking a backup method, know what you need to protect. Most Ubuntu users should cover these four areas.
/home stores your personal files, documents, and application settings. Many tools back this up by default, but check that hidden folders like .config and .ssh are included — they often hold settings that are time-consuming to recreate.
/etc contains system-wide configuration files for networking, services, and filesystem mounts. Backing it up makes it much easier to reproduce a working setup after a failure or when moving to a new machine.
Your installed package list is easy to overlook but valuable during recovery. Run apt-mark showmanual > installed-packages.txt to export it, and store the file somewhere outside the system you’re backing up.
Databases require a dedicated export tool rather than a direct file copy. Use mysqldump for MySQL and pg_dumpall for PostgreSQL — copying a live database directory can produce an inconsistent backup.
For desktop users, combining a personal-file backup with system snapshots covers most failure scenarios. For servers, the priority shifts to application data, database exports, and /etc.
Ubuntu offers several backup tools, from graphical applications for desktop users to command-line utilities built for servers and encrypted repositories. The sections below cover four methods, with steps to set up, run, and restore from each one.
Déjà Dup is a graphical backup tool built on Duplicity. It supports encrypted, incremental backups to local drives, network locations, and Google Drive, and is aimed at desktop users who want reliable file protection without using the command line.
It is well suited for backing up personal files and application settings. It does not create a full system image and is not designed for server environments.
How to Set Up Déjà Dup on Ubuntu
Step 1. Install Déjà Dup.
Open a terminal and run:
sudo apt update && sudo apt install deja-dup
Once installed, open it from the application menu by searching for Backups.
Step 2. Choose folders to include and exclude.
Déjà Dup backs up your home directory by default. Review the included and excluded folders to make sure hidden configuration directories such as .config and .ssh are covered, and remove any folders you do not need, such as Downloads.
Step 3. Choose a backup destination.
Select where your backups should be stored. Supported options include a local or external drive, a network location, and Google Drive via GNOME Online Accounts. Avoid storing backups on the same disk as your Ubuntu installation.
Step 4. Enable automatic backups and encryption.
Turn on scheduled backups and set a frequency that matches how often your files change. If you enable encryption, store the passphrase somewhere safe — without it, the backup cannot be restored.
How to Restore Files with Déjà Dup
Step 1. Connect the backup drive or make sure the backup location is accessible.
Step 2. Open Backups and select Restore Files.
Step 3. Choose the backup location and the date you want to restore from.
Step 4. Select the files or folders to recover and click Restore. Once complete, open the files to confirm they are intact.
For system-level rollbacks, Timeshift is a better tool.
Timeshift creates snapshots of your Ubuntu system so you can roll back after a failed update, a broken driver installation, or a configuration change that leaves the system unstable. It works similarly to a system restore feature, letting you return to an earlier state without reinstalling Ubuntu from scratch.
Unlike Déjà Dup, Timeshift is designed to protect system files, not personal data. It excludes /home by default, so it should always be paired with a separate file backup.
RSYNC Mode vs. BTRFS Mode
Timeshift supports two snapshot methods:
rsync and hard links to create snapshots. Compatible with common filesystems such as ext4 and suitable for most Ubuntu installations.@ and @home subvolumes.For a standard Ubuntu installation on ext4, choose RSYNC mode. Only select BTRFS mode if your filesystem and subvolume layout are confirmed to be compatible.
How to Install and Configure Timeshift
Step 1. Install Timeshift.
sudo apt update && sudo apt install timeshift
Launch the graphical interface from the application menu or run:
sudo timeshift-gtk
Step 2. Select the snapshot type.
Follow the setup wizard and choose RSYNC for a typical ext4 installation, or BTRFS for a compatible setup.
Step 3. Choose the snapshot location.
Select a disk or partition to store snapshots. Use a separate storage device where possible so that a system disk failure does not take the snapshots with it.
Step 4. Configure the snapshot schedule.
Set the snapshot frequency (daily, weekly, or monthly) and the number of snapshots to retain. Also review the user-directory settings — Timeshift excludes personal files by default, which keeps snapshot sizes manageable but means those files need a separate backup.
How to Create a Timeshift Snapshot
Via the GUI: Open Timeshift and click Create. The first snapshot may take longer than subsequent ones.
Via the CLI: Run the following before a system upgrade or major change:
sudo timeshift --create --comments "before upgrade" --tags D
--tags D marks the snapshot as a daily-type entry. It does not configure a schedule.
How to Restore from a Timeshift Snapshot
If Ubuntu can still boot: Open Timeshift, select the snapshot you want to restore, and click Restore. Review the proposed changes before confirming, as the restore will overwrite system files and settings made after the snapshot.
If Ubuntu cannot boot: Start from a Ubuntu live USB, install Timeshift in the live environment, then list available snapshots:
sudo timeshift --list
Select the appropriate snapshot and follow the restore prompts. If the system uses separate boot partitions, make sure the relevant filesystems are mounted before running the restore.
Limitations
/home by default — personal files need a separate backupPair Timeshift with a file-level backup tool for complete coverage. For server environments or more flexible file backup needs, rsync is covered in the next method.
rsync is a command-line utility that copies files between locations, transferring only what has changed. It is lightweight, supports remote transfers over SSH, and integrates well with cron — making it a practical choice for Ubuntu server backups.
Unlike Timeshift, rsync gives you direct control over what gets copied. Retention, encryption, and versioning are not built in and need to be configured separately.
Basic rsync Backup
Step 1. Confirm the external drive’s mount point:
lsblk -f
Step 2. Back up your home directory:
rsync -avh --progress /home/ /media/backup/home/
-a preserves permissions and timestamps, -v shows output, -h uses human-readable sizes. The trailing slash on /home/ copies the directory’s contents rather than the directory itself.
Step 3. Verify with a dry run before using --delete, which removes destination files no longer present in the source:
rsync -avhn --delete /home/ /media/backup/home/
Back Up the Root Filesystem
For servers, exclude virtual and temporary filesystems when copying /:
sudo rsync -aAXHv \
--exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} \
/ /media/backup/rootfs/
This is a file-level copy, not a disk image. Handle separate partitions and databases independently — never copy a live database directory with rsync.
Incremental Backups with Hard Links
Use --link-dest to create space-efficient versioned backups. Unchanged files are shared between snapshot directories via hard links rather than copied again:
sudo rsync -aHAX \
--link-dest=/media/backup/previous \
/home/ /media/backup/current/
Source and destination must be on the same filesystem for hard links to work.
Remote Backup over SSH
rsync -avz /home/ user@remote-server:/backups/home/
-z compresses data in transit. Use SSH key authentication for unattended runs. Files are not encrypted at rest on the remote server.
Automate with Cron
Save a script to /usr/local/bin/ubuntu-home-backup.sh:
#!/bin/bash
set -euo pipefail
rsync -avh --delete /home/ /media/backup/home/
Make it executable and schedule it:
sudo chmod 750 /usr/local/bin/ubuntu-home-backup.sh
sudo crontab -e
Add the following line to run it daily at 2:00 a.m.:
0 2 * * * /usr/local/bin/ubuntu-home-backup.sh >> /var/log/ubuntu-home-backup.log 2>&1
Confirm the backup drive is mounted before the job runs — otherwise rsync may write to the root filesystem instead.
Verify Backup Integrity
Always test that backups are actually recoverable. Run a checksum comparison with rsync -avhc --dry-run, review logs for skipped or failed files, and periodically restore a sample to confirm the files open correctly.
Restic and Borg both offer deduplication and encryption — two features rsync does not handle on its own. Both tools maintain snapshots or archives that let you recover files from earlier points in time, making them well suited for automated, secure backups on Ubuntu servers.
Restic
Step 1. Install Restic:
sudo apt update && sudo apt install restic
Step 2. Set your repository path and password, then initialize:
export RESTIC_REPOSITORY="/media/backup/restic-repo"
export RESTIC_PASSWORD="your-password"
restic init
For unattended backups, store the password in a permission-restricted file rather than in a script or shell history.
Step 3. Run your first backup:
restic backup /home
Subsequent runs only transfer changed data.
Step 4. List snapshots and restore:
restic snapshots
restic restore --target /tmp/restic-restore
Restore to a separate directory first and verify the files before overwriting anything in production.
Automate with systemd: Create a oneshot service that runs restic backup /home and pair it with a daily timer. Store the repository password in a 600-permission credentials file loaded via EnvironmentFile. Schedule restic forget and restic prune separately to manage retention.
Borg
Step 1. Install Borg:
sudo apt update && sudo apt install borgbackup
Step 2. Initialize an encrypted repository:
borg init --encryption=repokey /media/backup/borg-repo
Keep the passphrase and repository key in a safe location separate from the backup storage.
Step 3. Create an archive:
borg create --stats --progress --compression zstd \
/media/backup/borg-repo::'{now:%Y-%m-%d_%H:%M}' \
/home
Step 4. List archives and restore:
borg list /media/backup/borg-repo
borg extract /media/backup/borg-repo::ARCHIVE_NAME --destination /tmp/borg-restore
Automate with systemd: Use the same service-and-timer approach as Restic, with borg create as the main command. Note that %% is required in systemd service files to escape percent signs in the timestamp format. Schedule borg prune separately for retention management.
The methods above work well for individuals and small teams, but enterprise environments have different demands: multiple Linux and Windows servers, compliance requirements, centralized policy management, and audit trails. Managing these with separate rsync scripts or per-server tools quickly becomes unmanageable.
i2Backup is an enterprise backup solution that manages physical servers, virtual machines, and databases from a single console. It supports Ubuntu and other Linux distributions alongside Windows, making it a practical option for mixed IT environments.
Key capabilities relevant to Ubuntu server backup:
i2Backup is suited for companies managing backups across multiple Ubuntu servers, industries with compliance and audit requirements such as finance and healthcare, and mixed environments running both Linux and Windows infrastructure.
A good backup tool is only part of the equation. These practices help make sure your backups are actually usable when you need them.
A backup job that completes without errors is not the same as a backup you can recover from. Restore a sample of files to a separate directory periodically, test database recovery in an isolated environment, and confirm you know how to recover if Ubuntu no longer boots.
Keep three copies of your data, on two different storage types, with one copy offsite. For a typical Ubuntu server: the original data on the system, a backup on a separate drive or backup server, and an encrypted copy in remote or cloud storage. At least one copy should be isolated from routine system access to reduce exposure to ransomware and accidental deletion.
Manual backups are easy to skip. Use Déjà Dup’s built-in scheduler for desktop backups, Timeshift for system snapshots, and cron or systemd timers for rsync, Restic, or Borg. Make sure scripts verify that the backup destination is mounted before writing — otherwise a disconnected drive can silently redirect output to the root filesystem.
A scheduled job is not a guarantee. Storage full, expired credentials, or a disconnected drive can all cause silent failures. Check exit codes, retain job logs, and where possible monitor the age of the last successful backup rather than just whether the job was triggered.
Backups often contain credentials, database records, and private keys. Enable encryption in Déjà Dup, Restic, or Borg, store passphrases in a secure password manager, and keep encryption keys separate from the backup data. Note that SSH encrypts data in transit but does not encrypt what is stored at the destination — repository-level encryption handles that.
The best way to back up Ubuntu Linux depends on what you need to protect and how you plan to recover it. Déjà Dup is suitable for desktop users backing up personal files, Timeshift helps roll back system changes, rsync provides flexible file-level backups, and Restic or Borg offers encrypted, deduplicated backups for more advanced needs.
For businesses running Ubuntu servers, a comprehensive backup strategy should also account for centralized management, data protection, and disaster recovery. Info2soft provides data protection solutions to help businesses safeguard critical data and maintain service continuity.
For reliable protection, combine the right backup tools with automated schedules, offsite copies, and regular restore tests. A backup strategy that covers both important data and system recovery will help you restore Ubuntu more confidently when something goes wrong.
· Enterprise & Mid-market Customers Worldwide
· Support team available to assist you throughout your trial
· Start a 60-day free trial or view demo to see how Info2Soft protects enterprise data.