Usages
How to Use Rdiff-backup tool Making a local backup
We have two directories in our machine, one named as the source is where we have stored few files. Now want to back up those files in a separate directory, named back_folder.(Both are in the same path)
Now to back up the contents of the source, run the following command.
sudo rdiff-backup source back_folder
As it can be seen that all the contents of the directory source have been copied to back_folder. A new directory, with the name rdiff-backup-data. This directory contains crucial files pertaining to the backup process such as backup logs.
To back up directory, a general command would be
sudo rdiff-backup source_dir back_dir
Where, source_dir is the directory to be backed up, while back_dir is the name of the directory where files will be backed up.
Restoring data from a local backup:
Suppose, we want to restore the data from a particular directory, run the following command
sudo cp -a backup rest
where, backup is the directory, which contains, and rest is the directory to which the files have to be restored.
Backing up a directory to a remote Linux system:
As mentioned above, it is needed to connect to the remote system first.
- Connect to the remote server using SSH
- Install Rdiff backup in the remote system.
- Thereafter start the backup process.
Both the things are done in Step I of the Installation process. Now we will proceed with the backup part. Suppose there are two Systems with the following IPs
Origin Server: ip_origin Backup Server: ip_backup
where ip_origin is the IP address of the Origin server or the remote server, while ip_backup is the IP address of the backup server. The backup is done from the backup server. So first it is needed to SSH into the back server, using the below command:
ssh root@ip_backup
Later wards, use the following to backup
rdiff-backup root@ip_origin::/source_dir/ /back_dir/
This will back up the contents of source_dir to back_dir of the backup server.
Our remote server has an IP address of 104.198.150.1 and a name server2. To initiate the process, write the following in the terminal:
ssh -i ~/.ssh/my-ssh-key server2@104.198.150.1
Now start backing up the directory present at the remote server, which will be stored in the directory /home/var in the backup server
root@abhi rdiff-backup ~/server2@104.198.150.1 varBack
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-platforms like FreeBSD.
It works on the protocol of reverse incremental backup( i.e. only store the differences from the previous backup is updated to the next one), hence making it easier and quicker to restore the most recent backups. And ensuring that one gets the latest backup. Moreover, one can easily restore the files and access them.
Installation Process
The installation is a 2 step process. First, one needs to install the dependencies and then install the tool itself. The installation depends on the type of machine, one is using. The article will provide step-by-step guidance for the installation process.
System Dependencies:
The latest version of Rdiff-backup tool requires the following to be installed on one’s machine:-
- Python 3.6 or higher.
- librsync 1.0.0 and later
- pylibacl( Optional): To support Access Control Lists*
- pyxattr (Optional): To support Extended Attributes*
- Passwordless SSH ( For remote access)
Installation on Ubuntu 20.04 or Debian Buster / Older versions of Ubuntu/Debian:
It indicates that the present version of Python is greater than 3.6, which meets the requirements. If such is not the case, then it is needed to be installed in the system. Run the following commands
$ sudo apt-get update $ sudo apt install rdiff-backup
Now, check the version of the tool:
On CentOS 8/RHEL 8:
First it is required to enable the COPR(Cool Other Package Repo) Repository.
sudo dnf install yum-plugin-copr epel-release sudo dnf copr enable frankcrawford/rdiff-backup
Once the repository has been added, install the Rdiff-backup tool
sudo dnf --enablerepo=PowerTools install rdiff-backup
On CentOS 7/RHEL 7:
sudo dnf install rdiff-backup