How to configure rsnapshot for local backup

Backup Computer Key In Blue For Archiving And Storage


We already talked about the usage of rsync to make (and restore) a backup. Today, we’ll go further, talking about a tool built upon rsync: rsnapshot.
This is a Perl script which gives chance to take snapshots of filesystem at different times. In shortage, the first backup is a “full image” of the filesystem, while then it saves only the differences, intelligently using hard links.
If you use it with SSH, it is possible to use the tool for make backup of remote machines.


During the installation process, an example config file will be created in /etc. It is called


. The first thing to do is to make this your config file.

cp /etc/rsnapshot.conf.default /etc/rsnapshot.conf

Now, it’s time to adapt the config file.

Modify the config file

First, we have to choice a place in which save the snapshots. In this example, it will be


: this is called snapshot_root.

Note: in the following commands, elements are separated by tabs, not spaces.

Uncomment cmd_cp and make sure that it contain the path to GNU cp.
Then, make the same thing with cmd_rsync, which, as the name suggests, “points” to rsync. If you want also the functionality of a logger, don’t comment out cmd_logger.
So, after setting up these parameters, it’s necessary to decide how often take snapshots, and this is only a users choice, of course. In order to specify how much data to save, we must tell rsnapshot which “intervals” to keep, and how many of each; in this context, an “interval” is the unit of time.
For accomplishing that tasks, check the interval parameter. In the default config file, there are two lines:

interval hourly 6

This means that rsnapshot will make 6 snapshots every day…

interval daily 7

…while this second set of backup will be taken once a day, and stored for a week.

It’s important to note that “hourly”, in config file, is written before “daily”, and this is not arbitrarily: in fact, the first interval line is the smallest unit of time.

Now, we must decide what files we want to back up. For instance, we could want to back up all content of 


. In /etc/rsnapshot.conf, set up the backup parameter, just like this:

backup /home/ localhost/


localhost/ is the name of the folder, inside our snapshot_root, which will contain the snapshots of


In a similar way, if we want to work with remote machines, backup will contain the full paths to remote filesystems:


In this case, of course, it’s necessary to have SSH configured on our remote systems.

Testing configuration

To test a configuration file is very easy. Users must execute the command:

rsnapshot configtest

and wait for the output, which, if everything went fine, should be “Syntax OK”.


Now that we configured rsnapshot, the last thing will be to automatize the process, configuring cron to execute it periodically. That depends on you.

As said in the introduction, the amount of disk space taken up will be equal to one full backup, plus an additional copy of every file that is changed and, with little overhead due to the hard links.