How to Back Up a Linux Server for System Admins

How to Back Up a Linux Server for System Admins

Backing up a Linux server can have its ups and downs; figuratively and literally. In the past few years, the expectation has been that you need lots of manpower, free storage, and patience. It can feel complex since Linux is still a predominantly a command-line operating system.

But is that still the case in 2020? Here at Zmanda, we would like to think not.

Why is there so much talk around backing up Linux servers anyway?

Before answering this question, we have to understand server-class machines.

 

High-Performance Server Class Machines

Server class machines are a breed apart and are something most System Admins are eager to get their hands on. The sheer reliability, speed, and I/O Ops is something that is eagerly sought out. You might even say it\'s on the wish list of System Admin\'s when looking for a backup solution.

As we all know, a System Admin\'s work depends on high availability and high reliability of infrastructure. In addition to the features of server-class machines, their backup strategy also needs to provide the utmost prominence and foolproof solutions.

Server boxes are broadly classified into Windows machines and Unix Servers.

Windows Server includes: Windows Server 2003 (April 2003), Windows Server 2008 (February 2008), Windows Server 2012 (September 2012), Windows Server 2016 (September 2016) Windows Server 2019 (October 2018).

When it comes to the other side, there are almost six hundred Linux distributions, with close to five hundred out of those in active development. There are commercially backed distributions, such as Fedora (Red Hat), openSUSE (SUSE), and Ubuntu (Canonical Ltd.), and entirely community-driven open-source distributions, such as Debian, Slackware, Gentoo, and Arch Linux.

Today, we will be looking at only Unix OS.

 

Types of Linux Servers

There are 3 types of Linux servers:

    • Linux File Server
    • Linux Web Server
    • Linux Database Server

If you look at any organization or an application framework, it usually is a three-tier application. A front end UI app (like google or yahoo web pages), is hosted on middleware like (Tomcat or a Websphere Application server) and the data generated, is stored in a Database Server (MySQL/ Mongo DB).

Files and images that need constant changes and retrievals are stored on a shared drive, like samba or NFS Storage. These files are usually hosted on another Linux Server as a file-system. This helps in quick retrievals and file consumption for the end-user.

On each of these servers, the amount of data stored and needed for business-critical functionality is vast. Imagine if you\'re a part of the IT department of a financial organization and the infrastructure was penetrated due to a vulnerability of a firewall leak and the entire system was scrubbed. The loss could break the organization instantly and be chaotic for the IT department.

 

Types of Backups That Can Be Done on the Linux Server

The types of backup can be broadly classified into two sections:

    • File System backup using Command line tool r-sync
    • System backup using backup software like Zmanda

On command-line backup, the most common and easiest is the r-sync command. This is by far most preferred by System Admins.

 

How to Backup Your Entire Linux System Using Rsync

First, insert your backup medium (USB thumb drive or external hard disk). Then find the drive letter using \'fdisk -l\' command.

$ sudo mount /dev/sdb1 /mnt

My drive is detected at /dev/sdb1 and is mount point is /mnt

To back up the entire system, all you have to do is open your Terminal and run the following command as the root user:

$ sudo rsync -aAXv / --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /mnt

This command will backup the entire root ( / ) directory, excluding /dev, /proc, /sys, /tmp, /run, /mnt, /media, /lost+found directories, and save the data in /mnt folder.

You can alternatively explore the tar command options

tar cvzf /media/your_harddisk/backup.tar.gz /

Where the "your_harddisk" is the label or name of your hard disk.

The command will back up entire filesystems in the Linux machine, creating a gzip type of compression.

 

How to Restore Your Backups

# tar -xvpf /media/your_harddisk/backup.tar.gz

Alternatively, the second method uses backup solutions. This can help in securing backup and restore operations.

These back-up and restore solutions readily help store and restore operations.

 

Bottlenecks System Admins Can Run Into While Backing Up and Restoring

If we take a look at the solutions, we have both the command line and backup software, which can be used to back up the filesystem.

But is it completely fool-proof? 

Most time, the reality is far too different from the expected behavior.

    • The disks used in the backup may be corrupt.
    • The filesystem used between the source and the destination may be different.
    • The backup may have incurred a Read-Write I/O errors, which could have lost some data.
    • The data backed up may not have been at the appropriate time.
    • The commands used may not have completed the backup.
    • The storage used may get damaged during transit and hence failing the restore process.

Understanding these bottlenecks beforehand can be the difference between a successful backup and restore strategy and a completely failed one.

Also, be sure to check out the Points to Include in Your Disaster Recovery Plan


Explore More Topics