Configure rsnapshot on Tempest

Print Friendly, PDF & Email

I’m configuring rsnapshot to run on Tempest. It had been running, for many years, on Puma, but we’re going to re-install on Puma and I want the two machines to be as identical as possible, so both will be acting for themselves, not for each other.

Rsnapshot is very nice software for backing up machines and conserving disk space by using hard-links to identical files instead of copies. This isn’t perfect, but it’s very good. The imperfections are

  • if a file hasn’t changed, so that there are many hard-links to a single copy, but that single copy gets corrupted, you essentially have no backups, and
  • a filesystem with many hard-links can prove challenging to fsck, as I learned recently

We now use CrashPlan for backups of user files, but I like using rsnapshot because we can easily see and compare system configuration changes.

Here’s how I set it up on Tempest.

First, install using Yum:

[root@tempest ~] yum search rsnapshot
No Matches found
[root@tempest ~]

Darn, not in the standard repos. So, guess that it might be in EPEL:

[root@tempest ~] yum --enablerepo=epel search rsnapshot
============================== N/S Matched: rsnapshot ==============================
rsnapshot.noarch : Local and remote filesystem snapshot utility
Name and summary matches only, use "search all" for everything.
[root@tempest ~]

Win! Okay, install it:

[root@tempest ~] yum --enablerepo=epel install rsnapshot
 Setting up Install Process
 Resolving Dependencies
 --> Running transaction check
 ---> Package rsnapshot.noarch 0:1.3.1-12.el6 will be installed
 --> Finished Dependency Resolution
Dependencies Resolved
============= Package Arch Version Repository Size =================================
 Installing:
 rsnapshot noarch 1.3.1-12.el6 epel 116 k
Transaction Summary
 =================================
 Install 1 Package(s)
Total download size: 116 k
 Installed size: 377 k
 Is this ok [y/N]: y
 Downloading Packages:
 rsnapshot-1.3.1-12.el6.noarch.rpm | 116 kB 00:00
 Running rpm_check_debug
 Running Transaction Test
 Transaction Test Succeeded
 Running Transaction
 Installing : rsnapshot-1.3.1-12.el6.noarch 1/1
 warning: /etc/rsnapshot.conf created as /etc/rsnapshot.conf.rpmnew
 Verifying : rsnapshot-1.3.1-12.el6.noarch 1/1
Installed:
 rsnapshot.noarch 0:1.3.1-12.el6
Complete!
 [root@tempest ~]

The .rpmnew is because I had previously copied over the old rsnapshot.conf file. Let’s see what the differences are:

[root@tempest etc] diff rsnapshot.conf rsnapshot.conf.rpmnew
32c27
< snapshot_root /root/snapshots/tempest/ --- > snapshot_root /.snapshots/

That’s just where the copies will be stored. We’ll store them on /data, which is a different piece of hardware (a NAS), so that if Tempest completely dies, we’ll see what the configuration files are on /data

38c33
< no_create_root 1
> #no_create_root 1

This variable says not to do the backups if the snapshot_root isn’t there. If the NAS isn’t there or isn’t mounted, we don’t want to fill up this machine.

94c89
< #interval hourly 6
> interval hourly 6
97c92
< interval monthly 6
> #interval monthly 3

These say how many hourly or monthly backups to retain before they are deleted. We don’t use hourly, and 6 months is more than enough.

149c144
< one_fs 1
> #one_fs 0

This says that if you get to another file system, when recursively traversing one that you are backing up, skip it. Setting this to 1 keeps us from backing up /home and /students and /data2 and even /data when backing up /. However, it means we have to list all the ones we do want to back up.

196,209c195,199
< # TEMPEST
< backup / slash/ exclude=/proc,exclude=/dev,exclude=/tmp,exclude=/sys
< backup /boot/ boot/
< backup /var/www www/ exclude=/var/www/html/fedora/
< backup /var/lib/tomcat6 tomcat/
---
> # LOCALHOST
> backup /home/ localhost/
> backup /etc/ localhost/
> backup /usr/local/ localhost/
> #backup /var/log/rsnapshot localhost/
213c203
[root@tempest etc]

And the preceding is the stuff we want to back up. We don’t back up /usr, because that’s mostly executable files that we don’t need. We similarly don’t need to back up most of /var, but we do want to back up the web pages and stuff in /var/www. Similarly, all the web applications in /var/lib/tomcat6.

Next, we need to configure when these things happen:

[root@tempest etc] cat /etc/crontab
# rsnapshot. Need to allow enough time for the deletes to finish
# so I did these every hour
10 0 1 * * root rsnapshot monthly
10 1 * * 0 root rsnapshot weekly
10 2 * * * root rsnapshot daily

Check the syntax of the config file:

[root@tempest etc] rsnapshot configtest
----------------------------------------------------------------
 rsnapshot encountered an error! The program was invoked with these options:
 /usr/bin/rsnapshot configtest
--------------------------------------------------------------
 ERROR: /data/rsnapshots/tempest does not exist.
 ERROR: rsnapshot refuses to create snapshot_root when no_create_root is enabled
 [root@tempest etc] mkdir /data/rsnapshots/tempest
 [root@tempest etc] rsnapshot configtest
 Syntax OK

Good. Now, run it for the first time.

 

About CS SysAdmins

The CS Department System Administrators
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *