How to Backup (and Restore) Your Ubuntu Computer

choubertsprojects

The Best WordPress plugins!

1. WP Reset

2. WP 301 Redirects

3. WP Force SSL

If you want to make sure your settings are safe, or that your computer doesn’t stop working in the future, there’s no better way than making backups.
This tutorial will show you how to create a backup of your Ubuntu system and restore it if needed.

The “ubuntu server backup and restore” is a process that allows users to backup their Ubuntu computer. This process can be used to restore the system in case of a disaster.

How to Backup (and Restore) Your Ubuntu Computer

Every first-time Linux user or seasoned professional should know how to back up and restore home directories or whole file systems in Ubuntu Linux. Nobody wants to lose important data or have to start over with a new computer. It’s critical to consider an Ubuntu backup.

While there are numerous options for backing up Ubuntu, this post will focus on utilizing Déjà Dup Backups and Timeshift, two popular Ubuntu tools for backing up and restoring Ubuntu Linux systems.

Are you interested in learning how to back up your data or create a system image in Linux? Let’s get this party started!

Prerequisites

Step-by-step directions are included in this lesson. You’ll need the following items to follow along:

  • Your choice of Linux desktop OS or an Ubuntu Linux Desktop 20.04 LTS computer.
  • Make sure snapd is installed on your computer.

Using Déjà Dup to Back Up and Restore Files

Let’s get this Ubuntu backup lesson started using Déjà Dup, a popular backup application. Déjà Dup is a file backup and restore program for Ubuntu Linux as well as other Linux distributions such as Fedora, Red Hat Enterprise Linux, Manjaro, and OpenSUSE.

Déjà Dup is a great free and open-source software (FOSS) backup application for Linux. It makes backing up and recovering data a snap!

Déjà Dup Installation

You must first install Déjà Dup before you can back up your stuff. It just takes one step to do this.

Open a terminal on Ubuntu and type the command below. This command installs the deja-dup package using the snap package manager.

deja-dup —classic sudo snap install

Selecting Backup Files

After you’ve installed the program, you’ll need to decide what you want to back up. To do so, follow these steps:

1. Launch Déjà Dup by hitting the super-key (Windows key), typing Deja into the search field, and selecting the Backup icon, as shown below.

Opening Déjà Dup - Ubuntu Linux 20.04 LTS Ubuntu Linux 20.04 LTS – Opening Déjà Dup

When Déjà Dup first starts up, you have just two choices. To create your first backup, go to Create My First Backup:

Déjà Dup - Main MenuMain Menu – Déjà Dup

2. Next, click the plus symbol (+) to choose one or more folders to backup, or the minus sign (–) to delete any folders you don’t want to backup. To continue the backup process, click the Forward button once you’ve selected the folders to backup.

Déjà Dup will backup the current user’s home folder by default, but not the Trash folder.

Choosing which folders to back upChoosing which folders to back up

3. Select the Storage Location and Folder, then click Forward to determine where to save the backed-up data in the directories you specified.

By selecting the Storage Location dropdown menu, you’ll find that you have three alternatives (Local Folder, Network Folder, or Google Drive).

After you’ve chosen a Storage Location, use the Folder option to pick the Folder where all of the files will be saved. Click the Choose Folder button to explore the available folders on the selected Storage Location.

In this tutorial, the storage location will be a Local Folder, and the backup folder will be /backups.

Choosing a place for a backupChoosing a place for a backup

4. Provide a password to encrypt the backup if desired. This guide will show you how to password-protect your backup and set a strong password. Click the green Forward button to begin backing up your data after you’ve entered the Encryption password.

Creating an encrypted backup Creating an encrypted backup

Using Deja Dup to backup filesUsing Deja Dup to backup files

Backups on a Schedule

Deja Dup will lead you back to the main menu when the initial backup is finished, as illustrated below. You’ll see that the tool now shows you when the latest backup was taken. You may also use the Back up automatically option to arrange a daily backup using the same settings you used before.

Deja Dup main menu - automatic daily backupDeja Dup main menu – daily backups automatically

Click the drop-down menu icon in the title bar, as shown below, to change the backup frequency.

Using Deja Dup to adjust backup frequencyUsing Deja Dup to adjust backup frequency

To see available backup settings, such as storage location and schedule, go to Preferences.

Preferences of Deja DupPreferences of Deja Dup

You may alter the Location, how long backups are kept (Keep Backups), and more in the Preferences box.

Déjà Dup may do an automated backup every week or every day, rotating backups across three, six, or twelve months. If you have a lot of storage space and a lot of data, the default choice is forever!

Preferences for Déjà DupPreferences for Déjà Dup

Using Déjà Dup to Restore Files

A backup is useless unless it can be restored! Let’s look at how to get that backup restored.

1. Open Déjà Dup and choose Restore.

Restore the main menu of Deja Dup.Restore the main menu of Deja Dup.

2. Choose whatever files you want to restore. You may pick from the most recent backup by default, or use the Date option to access previous backups.

If you want to choose several files, click the checkbox button in the title bar.

Deja Dup allows you to pick and choose the files you want to restore.Deja Dup allows you to pick and choose the files you want to restore.

3. Click the green Restore button, as shown below, after you’ve picked all of the files you want to restore.

Using Deja Dup to restore filesUsing Deja Dup to restore files

4. Next, choose the place where you want the files to be restored. You may restore to the old place or a new location on the Restore to Where? screen. Your files will begin to restore after you’ve picked the destination location.

An example of the complete restoration procedure is shown below.

Deja Dup allows you to restore files to their original place.Deja Dup allows you to restore files to their original place.

Using Timeshift to Back Up and Restore Filesystems

Deja Dup is fantastic for backing up and recovering data, but what if you need to backup your whole hard drive? A backup snapshot is one of the most effective techniques to back up a whole disk. And the Timeshift tool, which is free and open-source, may let you accomplish exactly that.

To build file system images, Timeshift uses snapshot technology. Timeshift, like Windows System Restore, creates incremental file system snapshots that may be used to restore a system from the ground up using rsync or BTRFS (often called “Butter FS”).

Make sure you have an extra storage media to save a backup before beginning the demo below.

Putting Timeshift in Place

Let’s first start by Putting Timeshift in Place and see what it can do! To do so, open a terminal and run the following commands.

## To make the repository accessible for download, add it to apt-get using sudo add-apt-repository ppa:teejee2008/ppa ## sudo apt update download all available packages ## Run sudo apt install timeshift to download and install the Timeshift package.

Using Timeshift to Create a Backup Snapshot

It’s time to discover what Timeshift can accomplish now that you’ve installed it.

1. Type Timeshift in the search field while holding down the Super or Windows key.

Timeshift - Ubuntu 20.04 LTS Ubuntu 20.04 LTS – Timeshift

Timeshift must be executed as a root user. You may be asked for a sudo password depending on the account you’re using, as illustrated below.

Prompt for Authentication while launching TimeshiftPrompt for Authentication while launching Timeshift

2. Next, choose whether you want to produce an RSYNC or BTRFS snapshot and click Next. As you can see in the table below, RSYNC is the default snapshot type and will be the one you want to use for most applications.

RSYNC – Using rsync and hard links, the file system is copied to the target location. Every snapshot is a complete system backup that can be opened and browsed using a file manager like GNOME Files. This method conserves disk space by using shared files between snapshots. This article will show you how to make an RSYNC snapshot.

BTRFS — Uses copy-on-write (CoW) principles to create read-only snapshots, making snapshot creation quick. Only an Ubuntu-style sub-volume layout will work with these snapshots.

If you need to assure that backups are never updated for any reason, BTRFS can be a better backup choice.

With Timeshift, you may choose the Snapshot Type. With Timeshift, you may choose the Snapshot Type.

Timeshift will begin assessing the system’s size as soon as you click Next.

calculating the size of the systemcalculating the size of the system

3. Select a Snapshot Location in which to save the snapshot and then click Next.

The main drive (sda1) and a backup drive are seen in the screenshot below (sda2). Assume that sda1 contains the Linux system files that will be backed up using snapshots for the purposes of this article.

It’s important to note that distant and network locations aren’t supported.

Choosing a place for the snapshotChoosing a place for the snapshot

4. Select the snapshot frequency and the amount of snapshots to maintain, then click Next to establish a snapshot schedule.

A cron task takes snapshots every hour, but there is no set timing for them. 10 minutes after starting, boot snapshots are collected.

Snapshot Levels SelectionSnapshot Levels Selection

5. Next, choose Exclude All Files to notify Timeshift you don’t want User Home Directories to be included, then click Next and Finish.

You may even include home directories in the snapshot; however, this is not suggested. You’re restoring complete volumes to that point in time when you restore a snapshot. If you restore to a certain point in time, any significant modifications you made to a document, or even the creation of a new document, would be lost after the restore since they were not part of the snapshot.

User Home Directories Should Be ExcludedUser Home Directories Should Be Excluded

Timeshift will return you to the main window after you’ve completed the setup process.

Taking a Snapshot of a Backup

You can now make a snapshot once you’ve put one up. To do so, follow these steps:

1. On the main window, click the Create button.

In this primary window, you’ll also find options to Restore, Delete, and Browse existing snapshots.

Timeshift GUI - Menu GUI (Graphical User Interface) for Timeshift – Menu

Timeshift starts producing the snapshot as soon as you click Create, as seen below.

Timeshift GUI - Snapshot creation dialogueSnapshot creation dialogue in the Timeshift GUI

When the snapshot is finished, the snapshot will appear in the window.

Timeshift GUI - Snapshot inventorySnapshot inventory – Timeshift GUI

Examining the Snapshot

You may view the snapshot once it’s been made to see what file contents it backed up. To do so, right-click on the photo or choose it from the Browse menu.

In the /timeshift/backup/timeshift/snapshots/ directory, snapshots are organized into folders by snapshot name.

Using a file manager to look at the snapshot directoryUsing a file manager to look at the snapshot directory

Using Timeshift to Restore Snapshots

Now that you’ve made a Timeshift backup snapshot, it’s time to learn how to restore it. To restore a snapshot, Timeshift offers two options: using the GUI or using the command line.

Restoration of a timeshift snapshot using a graphical user interface

With Timeshift activated:

1. To restore a snapshot, first select it and then click the Restore button, as shown below.

Timeshift GUI - Restore buttonRestore button on the Timeshift GUI

2. Click Next after selecting a Target Device to restore the snapshot to. Snapshots may be restored to the original or to another device or volume.

When restoring snapshots, you may change bootloader parameters, allowing you to perform things like reinstall GRUB2, update the Grub menu, and so on.

Timeshift GUI - Restore to the target device Restore to the destination device using the Timeshift GUI.

When you click Next, Timeshift will do a ‘Dry Run’ to test the snapshot and create a list of activities performed on all files in the previous snapshot, as shown below.

Timeshift GUI - Dry RunDry Run with Timeshift GUI

3. Next, double-check that Timeshift will restore all of the files and then click Next.

Timeshift GUI - Confirming restore actionsConfirming restoration activities in the Timeshift GUI

4. Finally, accept the disclaimer and go to the next step to restore the snapshot.

It’s important to keep in mind that restoring from a snapshot will erase any files that have changed since the previous snapshot. This might lead to issues, which is why you should avoid using snapshots for files in your home directory.

Timeshift GUI - Last chance before potentially destructive actionsLast opportunity before possibly harmful acts with the Timeshift GUI

When the restoration process begins, your desktop will vanish and a terminal-like message will display, as seen below.

restoring datarestoring data

Your machine will reboot when the operation is completed, and the snapshot will be restored.

Command-Line Restoration of Timeshift Snapshots

You may also restore a Timeshift snapshot via the command line if you don’t want to use the GUI. It simply takes a few instructions to do this!

# Interactively restore options with timeshift —restore ## Find all available snapshots with timeshift —list # timeshift —restore —snapshot ‘2021-07-10_01-28-48’ # restore a specified snapshot

Other command line arguments for Timeshift may be relevant. For further information, go to the Timeshift online handbook page.

If you don’t have a running Linux installation to operate from, Timeshift also lets you utilize a live Linux CD/DVD. Timeshift may be temporarily installed from any recent Ubuntu Live CD/DVD image to read and restore snapshots.

Conclusion

You should now be able to perform an Ubuntu backup with the help of a couple of free tools. Déjà Dup is an excellent choice for setting and forgetting backups of your home directory. For more advanced full system backups with snapshots, check out Timeshift.

Which tool is your favorite?

You can use the “ubuntu 20.04 backup software” to back up your computer or restore it if you need to. The software is free and easy to download and install.

Related Tags

  • ubuntu backup and restore command line
  • backup files ubuntu command line
  • how to backup ubuntu before upgrade
  • how does ubuntu backup work
  • ubuntu backup image

Table of Content