A Versatile System Backup Script for Linux
Last Updated :
07 Apr, 2025
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.
- Backup: With this, we can take the tar backup archive of our system.
- Restore: Restore mode utilizes the archive created by the backup mode to extract it into expected partitions.
- Transfer: This mode uses rsyn to transfer our system to expected partitions.
Features
- It enables complete or Partial System Backup.
- The BIOS-based system is restored to UEFI and conversely.
- Restore/Transfer equivalent or different disk or the partition layout.
- Restore/Transfer the tar backup archive to an external drive such as SSD, SD, USB, etc.
- A virtual machine is arranged to back backup and restore the system.
Requirements
- For GUI we use gtkdialog 0.8.3
- To download the substitute archives we use wget- for retrieving files from (WWW )World Wide Web.
- As tar compressed the collection of files into an archive we use tar 1.27 and for the acls and xattrs support.
- For the Transfer mode, we utilize the Rsyn(Remote Sync)- for copying and organizing files and directories remotely.
- For GPT and Syslinux we use gptfdisk/gdisk.
- For encryption purposes, we use openssl/gpg.
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 RestoreSystem 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:
- -d - Describes the destination directory, in which the backup files will be stored.
- -u - Permits for reading additional tar or the rsyn operations.
- -i - Describes the operation mode, where zero (0) refers to the backup mode.
- -c - Specifies the compression utility.
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 BackupRestore 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:
- -G - Describes the grub partition.
- -r - Specifies targeted root (/) partition.
- -i - Describes operation mode one (1) which refers to restore mode.
- -f - Defines the path of the backup file.
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.
Similar Reads
Linux Shell Script to Backup Files and Directory
Backing up our important files and directories is crucial to safeguarding our data. In this article, weâll create a simple shell script that uses the tar utility to create an archive file for backup purposes that we can use whenever we require. The shell script weâll build allows us to specify which
5 min read
Backup Strategies for MongoDB Systems
In todayâs digital world, safeguarding data is very important. MongoDB, a popular NoSQL database, is widely praised for its flexibility, scalability, and ease of use. However, like all systems, itâs vulnerable to data loss due to hardware failures, software bugs, human errors, or even cyberattacks.
5 min read
Lynis - Security Tool for Audit and Hardening Linux Systems
Lynis is an open-source security auditing tool for UNIX derivatives like Linux, Mac OS, BSD, other Unix-based operating systems etc. Performing extensive health scan of systems that support System Hardening and Compliance Testing. An open-source software with GPL License. This tool also scans for ge
11 min read
Rdiff-backup - A Local and Remote Backup Tool for Linux
The Rdiff-backup(Reverse differential backup tool) is a backup tool that backs up one directory to another, either locally or remotely. It is a powerful tool written in Python, that works best with Linux. It works with Windows and Mac OS X as well. Users have reported that it works well on the cross
4 min read
How to Use Rsync to Make a Remote Linux Backup
Imagine losing all your data by accidentally doing sudo rm -rf /someDirectory, sucks right? But it happens to the best of us. Now, if it was a Windows system, we could have used numerous backup options like OneDrive to secure our data. But what about Linux? Fortunately, we have some very robust tool
4 min read
Create timestamp variable in bash script
Handling timestamps is a common need in Bash scripting for a number of tasks, including file naming, data processing, and logging. Tracking events or organizing data can be made easier with the help of timestamps, which serve as a precise point-in-time representation. Creating timestamps in Bash scr
4 min read
How to Create a Shell Script in linux
Shell is an interface of the operating system. It accepts commands from users and interprets them to the operating system. If you want to run a bunch of commands together, you can do so by creating a shell script. Shell scripts are very useful if you need to do a task routinely, like taking a backup
7 min read
Shell Script to Automate System Updates and Upgrades in Linux
Shell Scripts are often used for automating repetitive tasks that we can perform on a daily basis. With shell scripts, you can automate tasks like renaming a bunch of files or making backup scripts and many more complex tasks. As we all know, we often need to update and upgrade Linux packages and de
4 min read
Bash Script - File system
On a partition or disc, a file system is a logical grouping of files. A partition serves as a storage space for data and, if needed, can take up the entire hard disc. One file system may house the /file system, while another may house the /home file system. Your hard drive may have a variety of part
7 min read
Top 10 Backup Plugins for WordPress
When running a WordPress website, protecting your content through regular backups is essential. Imagine losing all your hard work due to a server crash, hacking attempt, or user error. Backups act as your safety net, allowing you to restore your site to its former credit quickly. This article will w
9 min read