System Tar and Restore - A Versatile System Backup Script for Linux

Channel: Backups Linux
Abstract: as shown. $ sudo ./star.sh -i 2 -r /dev/sdb2 -b /dev/sdb1 -t "/var=/dev/sdb4 /usr=/dev/sdb3" -G /dev/sdbRestore Linux System Backup You can also resto

System Tar and Restore is a versatile system backup script for Linux systems. It comes with two bash scripts, the main script star.sh and a GUI wrapper script star-gui.sh, which perform in three modes: backup, restore and transfer.

Read Also: 14 Outstanding Backup Utilities for Linux Systems

Features
  1. Full or partial system backup
  2. Restore or transfer to the same or different disk/partition layout.
  3. Restore or transfer backup to an external drive such as USB, SD card etc.
  4. Restore a BIOS-based system to UEFI and vice versa.
  5. Arrange a system in a virtual machine (such as virtualbox), back it up and restore it in a normal system.
Requirements:
  1. gtkdialog 0.8.3 or later (for the gui).
  2. tar 1.27 or later (acls and xattrs support).
  3. rsync (for Transfer Mode).
  4. wget (for downloading backup archives).
  5. gptfdisk/gdisk (for GPT and Syslinux).
  6. openssl/gpg (for encryption).
How to Install System Tar and Restore Tool in Linux

To install System Tar and Restore program, you need to first install all the required software packages as listed below.

$ sudo apt install git tar rsync wget gptfdisk openssl  [On Debian/Ubuntu]
# yum install git tar rsync wget gptfdisk openssl       [On CentOS/RHEL]
# dnf install git tar rsync wget gptfdisk openssl       [On Fedora]

Once all the required packages installed, now it’s time to download these scripts by cloning the system tar and restore repository to your system and run these scripts with root user privileges, otherwise, use the sudo command.

$ cd Download
$ git clone https://github.com/tritonas00/system-tar-and-restore.git
$ cd system-tar-and-restore/
$ ls
Install System Tar and Restore Linux System Backup

First create a directory where your system backup files will be stored (you can actually use any other directory of your choice).

$ sudo mkdir /backups

Now run the following command to create a system backup file in /backups directory, the archive file will be compressed using the xz utility, where the flags are.

  • -i – specifies the operation mode(0 meaning backup mode).
  • -d – specifies destination directory, where the backup file will be stored.
  • -c – defines the compression utility.
  • -u – allows for reading additional tar/rsync options.
$ sudo ./star.sh -i 0 -d /backups -c xz -u "--warning=none"
Perform Linux System Backup

To exclude the /home in the backup, add the -H flag, and use gzip compression utility as shown.

$ sudo ./star.sh -i 0 -d /backups -c gzip -H -u "--warning=none"
Restore Linux System Backup

You can also restore a backup as in the following command.

$ sudo ./star.sh -i 1 -r /dev/sdb1 -G /dev/sdb -f /backups/backup.tar.xz

where the option are:

  • -i – specifies operation mode (1 meaning restore mode).
  • -r – defines targeted root (/) partition.
  • -G – defines the grub partition.
  • -f – specified the backup file path.

The final example show how to run it in transfer mode (2). The new option here is -b, which sets the boot partition.

$ sudo ./star.sh -i 2 -r /dev/sdb2 -b /dev/sdb1 -G /dev/sdb

In addition, if you have mounted /usr and /var on separate partitions, considering the previous command, you can specify them using the -t switch, as shown.

$ sudo ./star.sh -i 2 -r /dev/sdb2 -b /dev/sdb1 -t "/var=/dev/sdb4 /usr=/dev/sdb3" -G /dev/sdb

We have just looked a few basic options of System Tar and Restore script, you can view all available options using the following command.

$ star.sh --help 

If you are accustomed to graphical user interfaces, you can use the GUI wrapper star-gui.sh instead. But you need to install gtkdialog – used to create graphical (GTK+) interfaces and dialog boxes using shell scripts in Linux.

System Tar and Restore Gui

You can find more command-line usage examples from the System Tar and Restore Github repository: https://github.com/tritonas00/system-tar-and-restore.

Summary

System Tar and Restore is a simple yet powerful, and versatile system backup script for Linux systems. Try it out comprehensively and share your thoughts about it via the feedback form below.

Ref From: tecmint

Related articles