System Administrator – Backup a Linux Server
Backing up a Linux server can have ups and downs figurative and literal. In recent years, you’re expected to need a lot of staff, free space, and patience. It can feel complex because Linux is still a predominantly command-line operating system.
- Is that still the case in 2020?
- Why is there so much talk about backing up Linux servers in the first place?
Before we can answer this question, we need to understand the machines of the server class.
High-performance machines of the server class
Server-class machines are a race in their own right, and most system administrators strive to get their hands on them. The mere reliability, speed, and I/O operations are something that is eagerly sought. You can even say that if you’re looking for a backup solution, it’s on the system administrators’ wish list.
As we all know, the work of a system administrator depends on high availability and infrastructure reliability. In addition to the capabilities of server-class computers, their backup strategy must also provide outstanding and easy-to-use solutions.
Server boxes are roughly divided into Windows computers and Unix servers.
Windows Server includes Windows Server 2003, Windows Server 2008), Windows Server 2012, Windows Server 2016 (September 2016) Windows Server 2019.
When it comes to the other side, there are almost six hundred Linux distributions, with nearly five hundred of them in active development. There are commercially supported distributions such as Fedora (red hat), openSUSE (SUSE), and Ubuntu (Canonical Ltd), and fully community-controlled open sources distributions, such as Debian, Slackware, Gentoo, and Arch Linux.
Today we will only deal with Unix OS.
Types of Linux servers
There are 3 types of Linux servers: Linux File Server, web server, and database server.
When you look at an organization or application framework, it is usually a three-tier application. A front-end UI app (such as Google or Yahoo websites) is hosted on middleware such as (Tomcat or a Websphere application server) and the generated data is stored on a database server (MySQL / Mongo DB).
Files and images that need to be constantly modified and retrieved are stored on a shared drive such as Samba or NFS Storage. These files are usually hosted on a Linux server other than the file system. This helps the end-user quickly retrieve and consume files.
On each of these servers, the amount of data stored and needed for mission-critical functions is enormous. Imagine that you are part of the IT department of a financial organization. The infrastructure has been penetrated due to a firewall leak vulnerability. The entire system has been cleaned up. The loss could immediately destroy the organization and be chaotic for the IT department.
Types of backups that can be performed on the Linux server
The types of backup can be roughly divided into two sections:
- File system backup with the r-sync command-line tool
- System backup with backup software
For command-line backup, the r-sync command is the most common and simplest. Therefore, This is the most preferred by system administrators.
How to back up your entire Linux system with Rsync
First, insert your backup media (USB stick or external hard drive). Then locate the drive letter with the command:
sudo mount / dev / sdb1 / mnt
Our drive is detected under / dev / sdb1 and the mount point is / mnt
All you need to do is open your terminal and execute the following command as a root user to back up the whole system:
sudo rsync -aAXv / --exclude = "/ dev / *", "/ proc / *", "/ sys / *", "/ tmp / *", "/ run / *", "/ mnt / * ", / media / * ", / lost + found " / mnt
This command backs up the entire root directory (/) with the exception of the directories / dev, / proc, / sys, / tmp, / run, / mnt, / media and / lost + found and stores the data in the folder / mnt.
Alternatively, you can explore the tar command options:
tar cvzf /media/your_hardDisk/backup.tar.gz /
Where the “your_hardDisk” is the name or name of your hard drive.
The command backs up entire file systems on the Linux computer and creates a gzip compression.
How to restore your backups
tar -xvpf /media/your_hardDisk/backup.tar.gz
Alternatively, the second method uses backup solutions. This can be useful when backing up backup and restoring operations.
These backup and restore solutions help you save and restore operations.
System administrators can encounter bottlenecks during backup and restore
If we look at the solutions, we have both the command line and the backup software that can be used to back up the file system. But is it completely foolproof?
Most of the time, the reality is far too different from the expected behavior.
- The hard drives used in the backup may be damaged.
- The file system used between the source and the destination may be different.
- The backup may have encountered read/write I/O errors that may have caused some data to be lost.
- The backed-up data may not have been at the right time.
- The commands used may not have completed the backup.
- The memory used may be corrupted during transport and therefore the recovery process cannot pass.
Prior understanding of these bottlenecks can make the difference between a successful backup and recovery strategy and a completely failed strategy.
Rahaf Ebraheem Itechonics - Web Developer