Rsnapshot: Difference between revisions

From ConShell
Jump to navigation Jump to search
Line 42: Line 42:
'''Q.''' Rsnapshot seems to fail in mysterious ways, like old backup sets hanging around, configuration pickiness (space for tab problem) and other types of nonsense. What are some ways to mitigate these problems?
'''Q.''' Rsnapshot seems to fail in mysterious ways, like old backup sets hanging around, configuration pickiness (space for tab problem) and other types of nonsense. What are some ways to mitigate these problems?


'''A.''' There are a number of things that can be done. First of all, having a configuration checker run (via cron) one or more times per day can help prevent a broken configuration from going unnoticed for very long. Examining the contents of the daily.0 (or hourly.0 if you go hourly) using '''ls -al daily.0/''' can help to expose stale folder structures (perhaps from a host that no longer exists). Finally, bump the verbosity on the logging and make sure the output from the rsnapshot cronjobs is getting sent to you via e-mail. Review this regularly for any sign of problems.
'''A.''' There are a number of things that can be done. First of all, having a configuration checker run (via cron) one or more times per day can help prevent a broken configuration from going unnoticed for very long. Examining the contents of the daily.0 (or hourly.0 if you go hourly) using '''ls -al daily.0/''' can help to expose stale folder structures (perhaps from a host that no longer exists). Finally, bump the verbosity on the logging and make sure the output from the rsnapshot cronjobs is getting sent to you via e-mail. Review this regularly for any sign of problems. Alternatively, see the cronjob example above for a command that will weed out the errors from the log.


[[Category:Applications]]
[[Category:Applications]]

Revision as of 12:08, 26 March 2010

rsnapshot is a filesystem snapshot utility for making backups of local and remote systems.

http://www.rsnapshot.org/

My favorite schedule is the 2-4 schedule, which yields full backup sets for today, yesterday and weeklies from as far back as a month.

rsnapshot.conf should contain...

daily 2
weekly 4

Cronjobs...

cat /etc/cron.d/rsnapshot
0       23       *       *       *   root    /usr/bin/rsnapshot daily
30      22       *       *       6   root    /usr/bin/rsnapshot weekly

#This sends a copy of any errors that occurred via e-mail to root
#Useful to identify when things have broken
21      6       *       *       *       root    cat /var/log/rsnapshot.log | grep ERROR

Backup disk full? Rsnapshot doesn't work well with compressed files, but there are a couple of work arounds.

The first is that SOME of the files in the backup set can be compressed, those that aren't in a linked set.

find weekly.1 -links 1 -size +1M ! -name "*.bz2" -print | grep -v \.svn  | xargs pbzip2 -v

Revert

find weekly.1 -links 1 -name "*.bz2" -print | xargs pbunzip2 -v

Another approach is to use a filesystem that supports compression like zfs or btrfs


Q & A

Q. How much data can rsnapshot backup and for how long?

A. This can be calculated as the size of the original backup set + the "churn", where churn is the size of all the files added or removed during the range from newest to oldest backup set. If the original+churn is larger than the total storage available for the backup, you will run out of disk space. To remedy, you can either shorten the retention time or reduce the size of the original set i.e. by using excludes

Q. What are some best practices for using Rsnapshot

A. First of all, when backing-up logfiles you should make sure your logrotate.d/* configurations specify 'dateext' and 'compress' options so that rotated logfiles have the date stamp and are precompressed before rsnapshot gets to them. This saves rsnapshot from saving multiple copies of the same data since the filenames won't be changing (0 to 1, 1 to2 etc). Another way is to use exclude="foo" options to minimize excessive backups.

Q. Rsnapshot seems to fail in mysterious ways, like old backup sets hanging around, configuration pickiness (space for tab problem) and other types of nonsense. What are some ways to mitigate these problems?

A. There are a number of things that can be done. First of all, having a configuration checker run (via cron) one or more times per day can help prevent a broken configuration from going unnoticed for very long. Examining the contents of the daily.0 (or hourly.0 if you go hourly) using ls -al daily.0/ can help to expose stale folder structures (perhaps from a host that no longer exists). Finally, bump the verbosity on the logging and make sure the output from the rsnapshot cronjobs is getting sent to you via e-mail. Review this regularly for any sign of problems. Alternatively, see the cronjob example above for a command that will weed out the errors from the log.