Install and use rsnapshot for data backup on Manjaro

There are various backup software available for Linux system. One of the most powerful backup software is rsnapshot. Rsnapshot is a filesystem backup utility based on rsync. Its a command line backup tool and there is no GUI for rsnapshot. Here I will show you how to perform backup on Manjaro using rsnapshot. For a complete information, please visit the official website of rsnapshot at: https://wiki.archlinux.org/index.php/Rsnapshot
First, we need to install rsnapshot. Open Terminal and type the following command:
sudo pacman -S rsnapshot
Output:
manjaro@manjaro ~]$ sudo pacman -S rsnapshot
resolving dependencies...
looking for conflicting packages...

Packages (2) perl-lchown-1.01-5  rsnapshot-1.4.2-2

Total Download Size:   0.08 MiB
Total Installed Size:  0.30 MiB

:: Proceed with installation? [Y/n] y
:: Retrieving packages...
 perl-lchown-1.01-5-x86_64                               8.4 KiB  0.00B/s 00:00 [##############################################] 100%
 rsnapshot-1.4.2-2-any                                  71.1 KiB  64.7K/s 00:01 [##############################################] 100%
(2/2) checking keys in keyring                                                  [##############################################] 100%
(2/2) checking package integrity                                                [##############################################] 100%
(2/2) loading package files                                                     [##############################################] 100%
(2/2) checking for file conflicts                                               [##############################################] 100%
(2/2) checking available disk space                                             [##############################################] 100%
:: Processing package changes...
(1/2) installing perl-lchown                                                    [##############################################] 100%
(2/2) installing rsnapshot                                                      [##############################################] 100%
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
Now we need to configure rsnapshot. Still in Terminal, edit the file /etc/rsnapshot.conf using your favorite text editor such as nano. 
sudo nano /etc/rsnapshot.conf
There are several items we need to configure. 

1. Snapshot location

Find the following line inside the conf file.
snapshot_root   /.snapshots/
Now change it to the new location if you want. All snapshot/backups will be saved on this directory. For example:
snapshot_root   /rsnapshot/backup/
Now we create the new directory for the snapshot
sudo mkdir -p /rsnapsot/backup

2. Backup Level/Interval configuration

Now we need to specify the interval of the backup. The backup can be configured to be executed in hourly, daily, weekly etc. Find the Backup Level/Interval Section as follow:

You may change the alpha, beta items to something else such as hourly, daily, weekly. But keep in mind, it must be in ascending order. For more info about retain backup, read it here: https://wiki.archlinux.org/index.php/Rsnapshot#Retain_Previous_Backups.

3. Backup Points

Now, we move to the last part. This section will configure what or which folders to backup using rsnapshot.
On this section we can add or remove backup points. By default, you can see that rsnapshot will backup your /home, /etc/ and /usr/local/ directories.You can either add or edit this entries. For example, I add other directories to be included.
Please keep in mind, that we must use Tab instead of Space to separate those entries above. Also, do not forget to add 'slash' ("/") to the end of each directory.
Rsnapshot also works for remote files as well. I will discuss more about how to backup remote files using rsnapshot next time. 
Now save and close the config file. At this point, we are ready to use rsnapshot. Lets test it first. Use configtest option to test our configuration file.
sudo rsnapshot configtest
It should returned Syntax OK if all the configuration are well.
[manjaro@manjaro ~]$ sudo rsnapshot configtest
Syntax OK
Now we can use this command to execute the actual backup
sudo rsnapshot alpha
For further and advanced use, we can create a crontab to run rsnapshot automatically on a specific time. Please stay tuned on this blog, I will demonstrate how to automate rsnapshot via crontab.


EmoticonEmoticon