BackUp and Restore Your Entire Hard Drive on Linux

Backup and recovery describes the process of creating and storing copies of data that can be used to protect organizations against data loss.

Similarly, Recovery from a backup typically involves restoring the data to the original location, or to an alternate location where it can be used in place of the lost or damaged data.

rsync is a protocol built for Unix-like systems that provides unbelievable versatility for backing up and synchronizing data. 

It can be used locally to back up files to different directories or can be configured to sync across the Internet to other hosts.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform Linux Backups and restoration.

In this context, we shall look into the steps to perform backup and restore files on Linux.

The Benefits of performing Backups and restore tasks in Linux?

Nowadays, server intrusion has become rampant and hackers are attacking millions of website every day. Therefore it is best to  perform a regular backup of your server at least once or twice  a month at intervals so that in the case where your data is compromised, you can quickly restore your website and Linux server without facing too much downtime.

Operating System Backup Process

Making a backup of your server should not be a difficult task to complete. Internal system tools in Linux have such features inbuilt in them.
I will take you through the steps in doing a backup process on a Linux Server.
Firstly, you have to create a unique location where you want the backup to stay in your server. You can also use an external Disk as a medium of storage of your backup if this will be preferred by you.
To make a directory , lets say "backup_directory" dedicated for the backup files, use the command below;
mkdir /backup_directory

Next, we will create a compressed form of the Operating system file referred to "tarball".
To do is in CentOS, RedHat and Fedora, use the command below;

tar cvpzf /backup_directory/backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/backup_directory --exclude=/dev --exclude=/sys --exclude=/boot/grub --exclude=/boot/grub2 --exclude=/etc/fstab --exclude=/etc/sysconfig/network-scripts/ --exclude=/etc/udev/rules.d/70-persistent-net.rules /

As for Debian or Ubuntu Distribution, use the command below;
tar cvpzf /backup_directory/backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/backup_directory --exclude=/dev --exclude=/sys --exclude=/boot/grub --exclude=/boot/grub2 --exclude=/etc/fstab --exclude=/etc/network/interfaces --exclude=/etc/udev/rules.d/70-persistent-net.rules /

The backup process might take some few minutes or hours to be completed successfully depending on the size of your Data and files on your server.
Therefore, patience is needed here.
As soon as the process is completed, the tarball file will be generated in /backup_directory/backup.tgz

The name can be modified as per the time you made the backup to enable you identity such backup files easily when you want to make a subsequent backup.

Restoring your Server's Operating System from your Backup

Restoring your server is necessary especially when you want to restore the Operating System of your server back to its previous state. As previously noted, during the backup process you can decide to save the Backup files in an external disk or on the same server.
To restore the backup on a new server, do the following;

Create a new directory by using the command below;
mkdir /backup_restore

Next, use the command below to copy the backup file to the operating system;
scp root@old_server:/backup_directory/backup.tgz /backup_restore

Where "old_server" should be replaced by your old server ip address.

To complete the restoration process, use the command below;
tar xvpfz /backup_restore/backup.tgz -C /

This process will restore the backup to the server.
Finally, do a "reboot" of the server.

Doing a backup of your server could be strange when you are not good with the Linux environment. Our Server Experts offer OS system Backups services.


#Backup and #restore refers to technologies and practices for making periodic copies of data and applications to a separate, secondary device and then using those copies to recover the data and applications—and the business operations on which they depend in the event that the original data and applications are lost.

#rsync uses what is called a delta-transfer algorithm which compares files from source and destination and sends only the differences between them.

To automatically backup #files and directories in Linux:

1. archive the content. Backing up your files using tar is very simple using the following command: # tar -cvpzf /backup/backupfilename.tar.gz /data/directory.

2. create backup script. Now let's add tar command in a bash script to make this backup process automatic.

#Rsync, or Remote Sync, is a free command-line tool that lets you transfer files and directories to local and remote destinations. 

Rsync is used for mirroring, performing backups, or migrating data to other servers.

Backing up file systems means copying file systems to removable media (such as tape) to safeguard against loss, damage, or corruption. 

Restoring file systems means copying reasonably current backup files from removable media to a working directory.

Data losses can be a very frustration encounter for a server owner. To avoid such catastrophic situations in losing your website data, it is very important to do a regular backup for your server and website.

Related Post

Keep In Touch

We hope to hear from you.

Accept File Type: jpg,jpeg,png,txt,pdf,doc,docx