Something You Didn't Know About Backing Up a Linux Server

Users consider the open-source Linux operating system to be quite comfortable when working with cloud structures, which are becoming more popular yearly. One of the features of this operating system is to make the most of all the advantages of the cloud.

It is not a secret that servers of Linux are designed with user security in mind. Such factors as security, flexibility, and stability have made many developers who need to back up their sites choose Linux.

Backup is valued for its function of preserving valuable data. The range of users of these resources is enormous. Still, since digital preservation is a responsibility in its own right, this system is vital for system administrators and workers dealing with corporate-level data.

Despite the advantages mentioned above, it is important to understand that this case requires some learning. Users can use several valuable programs here. We will now demonstrate how you can easily create backups using only two simple methods: 'Tar' and 'Bera.'

Tar Method as a Backup Tool

For this example, we will use Ubuntu as an operational system, which is in great demand among users as a Linux-based server.

Creating Backup with Tar Command

Type:

sudo tar --cvpzf backup.tar.gz --exclude=/home/server/backup.tar.gz --one-file-system

That command starts the backup process. This starts a backup of all data files on the selected server and archives them in g-zipped format. You can choose any name you like for naming the backup. In this example, we named it backup.tar. It is important to write -exclude to disable the function of "including" our backup into its previous version.

The ‘Tar’ command also saves you time during the file and folder setup phase by automatically creating a directory to work on the server you choose, making the process much easier.

After entering the given code, press Enter.

After that, you will see the file archiving stage begin on the system. As you work with the root channel, keep in mind that usually, it returns to the directories installed earlier.

Important: Make certain that the server you work on is not currently performing maintenance processes, as this will take longer to back up.

Extraction with Tar Command

Type:

sudo tar -xvpzf /home/server/backup.tar.gz -C / --numeric-owner

Press Enter.

This will start unpacking the files. This step will overwrite all earlier backup files. The same will happen with the previously installed files (on the condition that your system is functional).

If the system is reinstalled completely, the data will be recovered in its original form.

The so-called function -f  in this context refers to the title of the disk chosen to install the backup. If the backup location is the home server and it is the root backup, for better usability, restore the backup in the very same folder.

After the files have been extracted, restart your PC. After that, you will have the recovered system in the format it was during the backup.

Important: It is possible to create a backup and store it on a USB device. We do not recommend doing this because the massiveness of the files hinders a fast backup process. Keeping the backup at the root of the system or server is preferable.

Bera Method as a Backup Tool

Such tool as Bera Backup helps you perform a comprehensive backup of your Linux server. Its advantage is that compared to the 'Tar' command, it has a much larger selection of file extensions.

In the case of server migration, this command will take much less time. In addition, it is simpler and more convenient in relation to the method ‘Tar’.

One of the main features of the ‘Bera’ tool is its simplicity and speed. It`s possible to move the whole server without spending ten minutes.

During backups, it`s quite easy to include folders and tabs and get periodic notices. In addition to the significant difference with the ‘Tar’ command is the fact that the ‘Bera’ is RSync based, which indicates an additional level of security for users.

Main properties of Bera Backup

File Backups are commonly used for important files with the subsequent purpose of including them in your reserve copy.

System Configurations are for files such as crontabs, users, and iptables, as well as all packages installed.

Creating a Backup

Type:

./bera-backup.sh _path_config_backup

Press Enter. Once pressed, you can see Bera unfold the backup step.

Important: Before you start, it is strongly recommended to enable root permissions to prevent permissions difficulties, which can become a problem both during the operation of the Linux server backup and after it has been restored.

The command to Restore Backup

Type:

./bera-restore.sh _path_config_restore

Press Enter.

It is essential to remember the chosen path until the backup step begins, as it will replace the '_path' to retrieve the reserve copy from that location.

When setting up a backup, you will have a choice of configurable options available for Bera. We have provided a list of these parameters below:

Options

Overview

backupOrigin

If the server is a location of the backup, it specifies 'local.' If the path is another, then 'shh'

backupLocalDir

This is the directory containing the backup copy (or the directory to which it`s uploaded by SSH)

backupRemoteUser

SSH connection user (the server that is being backed up)

backupremoteserver

SSH remote server hosting the backup

backupRemotePort

Server port SSH 

backupRemoteDir

The remote directory. Find the backup here 

Conclusion

Backups are essential for users who always want to ensure their content is kept safe and secure.

Even if something goes wrong with your site, a backup ensures visitors have uninterrupted access to your site.

At first sight, the backup creation process seems quite complicated. But it is your right to choose from several methods which you find more comfortable and easier to use. Don't limit yourself to the methods mentioned above. You can easily use other tools for this kind of work. Many experts also recommend using ‘Bacula’ and ‘Rsync Commands.’

We also strongly recommend that you choose the hosting for your site responsibly, don't let cheap hosting be a trap for you.

Backups creation is not a complicated process, but be careful at the stage of choosing the path and the necessary configurations, and then the whole task will be pretty easy for you. 



Blog