System Tar Restore - Feature-rich Backup Script for Linux

"System Tar and Restore" is an open-source program for Linux that offers several options to create backups and restore them. It consists of two scripts: One is the main program and the other one is a GUI wrapper.

It has three different modes: Backup, Restore and Transfer. And it is available in Arch, Debian/Ubuntu, Fedora, OpenSUSE, Gentoo and Mandriva.

You can see the code and documentation on its official repository.

Features

  • Full or partial backup.
  • Restore or transfer the backup both to the same disk/partition or a different one.
  • Restore or transfer to an external drive, for example: A USB HDD, USB flash drive or SD card.
  • Restore to UEFI mode a system that was previously installed in BIOS mode, and vice versa.
  • Backup a system in a virtual machine and restore it in a normal machine.

Requirements

Make sure you have the following items before getting System Tar and Restore installed:

  • gtkdialog 0.8.3 or later (for the GUI)
  • tar 1.27 or later (acls and xattrs support)
  • rsync (for Transfer Mode)
  • wget (for downloading backup archives)
  • gptfdisk/gdisk (for GPT and Syslinux)
  • openssl/gpg (for encryption)

Installation

The following method should work in any Linux distribution, as it uses Linux standard tools.

This step is easy, you only have to download the source code from the releases section. In this example, I've downloaded the .tar.gz file.

Then, open a terminal in the folder where the source code has been downloaded and uncompress the file by typing:

$ sudo tar -xf system-tar-and-restore-6.8.tar.gz

Please note that the file name may vary depending on the downloaded version of the software.

Finally, you have to go to the extracted folder and execute the tool:

$ cd system-tar-and-restore-6.8
$ ./star.sh

If you want to use the software in GUI mode, execute the following script:

$ ./star-gui.sh

You'll see something like this:

star installation execute gui

Alternative method for Arch Linux - AUR

There is also an alternative method for Arch Linux using AUR:

Go to AUR - system-tar-and-restore and click 'Download snapshot' as the image shows:

star.sh-aur-download

Now open a terminal and go to the path where the package is located. Type:

$ tar -xf system-tar-and-restore.tar.gz
$ cd system-tar-and-restore
$ makepkg -csi PKGBUILD

And answer 'yes' to all.

Then, you can run the tool by typing the following (from any location):

CLI mode:

$ sudo star.sh

GUI mode:

$ sudo star-gui.sh

Modes

Here is a description of the modes and their options. I'll show you some examples in the next section of the article.

Backup

This mode allows the user to do a tar backup of your system. The following options can be defined:

  • Archive filename: This is how will the backup archive be named. Default is Backup-$(hostname)-$(date +%Y%m%d-%H%M%S).
  • Destination directory: The location where the backup archive will be saved. Default is /.
  • /home directory: You can do three different things: Include it completely, include only hidden files and folders (to keep login and some settings) or exclude it.
  • Compression: Gzip, bzip2 and xz formats can be used. You can also choose none for no compression. The official documentation recommends gzip.
  • Encryption method and passphrase: If you want to provide encryption to the archive select between openssl or gpg encryption methods. You should also enter a passphrase.
  • Archiver options: You can give additional parameters in the archiver. Typing tar --help will give you more information.

The program can read a configuration file, originally located in /etc/backup.conf. You can specify another path and then use it by typing star.sh -i 0 -C /path/backup.conf (CLI mode) or star-gui.sh /path/backup.conf(GUI mode). You can see the sample provided by the dev or generate a configuration file by adding the option -g.

You'll see a backup.log in the same path of the backup archive when the process is finished.

Restore/Transfer

The purpose of the restore mode is to extract the archive created in backup mode to a disk/partition. Transfer mode uses rsync to transfer your system to a disk/partition.

Both in restore and transfer modes, the tool generates the target system's fstab, rebuilds initramfs (for every installed kernel), generates locales and installs and configures the bootloader.

To use this option, you'll have to boot in your target distribution in live mode. You can boot also from other distro, but I recommend the first alternative.

Then, you can set the following options:

  • Target partitions: It is mandatory to choose a target root partition. Then, you can freely choose other partitions for /home, /boot or swap. If you are using UEFI you can specify a target ESP partition and it's mount point.
  • Mount options: For the target root partition, you can specify mount options, separated by commas. Defaults are defaults, noatime.
  • Btrfs subvolumes: You can create subvolumes if target root FS is Btrfs. Enter the paths separated by a space. Recommended root subvolume name is __active.
  • Bootloader: Grub 2 or Syslinux can be chosen on BIOS systems. If you use a RAID array, the tool will install the bootloader in every device of it. For UEFI you can choose Grub, EFISTUB/efibootmgr or Systemd/bootctl. Additional kernel options can be added too.
  • Modes: Restore: Specify the backup archive. Transfer mode (transfer /home, hidden files and folders or exclude).
  • Tar/Rsync options: You can specify more options. For help, type:rsync --help or tar --help.

A log is created in /tmp/restore.log when the process finishes.

Examples

You can use one-letter or full-word options. I'll show full-word only in the first example. You can type sudo ./star.sh --help in a terminal to see the parameters for the different options.

Backup

Example 1: Specify archive filename, destination, compression mode and additional options.

  • Archive filename: backup
  • Destination: /home/ivo/backups
  • Compression: gzip
  • Additional options: --exclude=/home/ivo/.cache/* --warning=none
$ sudo star.sh -i 0 --directory /home/ivo/backups --compression gzip --user-opts "--exclude=/home/ivo/.cache/* --warning=none" --filename "backup"

Example 2: Specify destination, compression mode, /home directory and encryption method.

  • Destination: /home/ivo/backups
  • Compression: bzip2
  • /home directory: Exclude it completely
  • Encryption with openssl
$ sudo star.sh -i 0 -d /home/ivo/backups -c bzip2 -E openssl -P 1234 -H

Restore

Example 3: Select root partition, bootloader and local mode.

  • Target partitions: root: /dev/sdb1
  • Bootloader: grub
  • Mode: Local archive
$ sudo star.sh -i 1 -r /dev/sdb1 -G /dev/sdb -f /home/ivo/backups/backup.tar.gz

Example 4: Select root partition, bootloader and remote mode.

  • Target partitions: root: /dev/sda4
  • Bootloader: EFISTUB
  • Mode: Remote file protected in http server
$ sudo star.sh -i 1 -r /dev/sda4 -F /dev/sda -f http://server/backup.tar.gz -y username -p password

Example 5: Select root and home partitions, bootloader and local mode.

  • Target partitions: root: /dev/sda2 , home: /dev/sda3
  • Bootloader: grub
  • Mode: Local archive
$ sudo star.sh -i 1 -r /dev/sda2 -h /dev/sda3 -G auto -f /home/ivo/backup.tar.gz

Transfer

Example 6: Select root partition, bootloader and kernel options.

  • Target partitions: root: /dev/sda1
  • Bootloader: Syslinux
  • Kernel options: nomodeset
$ sudo star.sh -i 2 -r /dev/sda1 -S /dev/sda -k nomodeset

Example 7: Select root,boot, usr and var partitions, bootloader and mode.

  • Target partitions: boot: /dev/sda1, root: /dev/sda2, usr: /dev/sda3, var: /dev/sda4
  • Bootloader: grub
  • Mode: Transfer /home's hidden files and folders only
$ sudo star.sh -i 2 -b /dev/sda1 -r /dev/sda2 -t "/usr=/dev/sda3 /var=/dev/sda4" -G /dev/sdb -O

Wrapping up

As you could see, System Tar and Restore is a simple tool that gives lots of possibilities at the time of creating and restore/transfer backups. The CLI version is maybe for more experienced users but it allows you to backup or restore something in a very fast way. However, the GUI version can help the newcomers if they don't feel comfortable with the first one.

This is a very interesting tool, I suggest you to try it when you need to make the next backup and explore all its options and combinations.

About Ivo Ursino

I'm an Information Systems Engineering student and Linux enthusiast. I enjoy learning new technologies and testing them so as to give my review and help with their improvement. Staying up to date in the digital world is a must for me.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.