Rsnapshot: Difference between revisions

From ConShell
Jump to navigation Jump to search
No edit summary
No edit summary
Line 30: Line 30:
Another approach is to use a filesystem that supports compression like [[wikipedia:ZFS|zfs]] or [[wikipedia:Btrfs|btrfs]]
Another approach is to use a filesystem that supports compression like [[wikipedia:ZFS|zfs]] or [[wikipedia:Btrfs|btrfs]]


Q. How much data can rsnapshot backup and for how long?
----
=== 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
'''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.
[[Category:Applications]]
[[Category:Applications]]

Revision as of 12:01, 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.