Open In App

A Versatile System Backup Script for Linux

System Tar and Restore is a flexible system and it has two bash scripts one is the main script star.sh and the other is the GUI wrapper star-gui.sh. It has three modes accessible in the System Tar and Restores system namely: Backup, Restore, and Transfer.

Features:

Requirements:

Installation of System Tar and Restore tool:

To set up the System Tar and Restore program, essential packages need to be installed.



Syntax:

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

By using these commands the required packages can be installed after installing the packages we need to download these packages by cloning the System tar and Restore repository into the local system and executing their programs with the privileges of the root user, in other cases use sudo command.



$ git clone https://github.com/tritonas00/system-tar-and-restore.git
$ cd system-tar-and-restore/
$ ls

Output:

Installing System Tar and Restore

System Backup:

The initial step is to create or select a directory to store the system backup files. then execute the commands mentioned below to create a system backup file in the /backups directory, then use the 

xz utility – this utility supports the compression of data this utility can be used for both compression and decompression of a file in accordance with the specified operation mode.

Flags used are:

Syntax:

$ sudo ./star.sh -i 0 -d /backups -c xz -u "--warning=none"

To eliminate the /home in the backup, then add the -H flag and use gzip utility- to compress and reduce the size of the files as shown below.

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

Output:

Starts to take system Backup

Restore the System Backup:

We use System Restore to extract the archived backup files and we can use the below flags to get details of the status.

Flags used are:

Syntax:

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

There is another example where we can use transfer mode (2) appending with the -b flag which set up the boot partition.

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

As well, if the system is mounted /usr and /var in different partitions, by specifying the -t flag to switch.

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

Using GUI (graphical user interface):

By using GUI wrapper star-gui.sh you can utilize the GUI. For this, you need gtkdialog- which will lead you to the graphical interfaces in Linux.

Conclusion:

System Tar and Restore are flexible, powerful, and feature-rich backup scripts that effectively back up the files in the local system. By using the System Tar and Restore we take backup and also it assists to restore and transfer to the current or a different disk partition.  

Article Tags :