long snapshots + scheduling
On Thu, Mar 29, 2012 at 01:07:00PM +0200, Helmut Hullen wrote:
Only the very new backup needs much time. On your system that may be
All other activities are much faster, most times it's only renaming.
Ok - deleting may also need some time, but it doesn't lock a new backup
Deletes are always done as part of rotation, and they're always done
last. Rotation and backup need an exclusive lock, maintained by the
lockfile that DK mentioned. Deletion however does not need a lock and
can be deferred to run later. See the use_lazy_deletes option.
If you turn that on, then directories to be deleted are renamed so as to
not be in the way, the rotation carries on as normal, the lock is
released, and then the delete happens. If you turn this on, then
rotation is very fast.
Here's some snippets from my logfile. The D or M at the beggining
indicates which rsnapshot job the line comes from ...
M [01/Jan/2012:23:30:02] /usr/local/bin/rsnapshot monthly: started
M [01/Jan/2012:23:30:02] echo 83228 > /var/run/rsnapshot.pid # get lock
M [ a bunch of 'mv's ]
M [01/Jan/2012:23:30:02] rm -f /var/run/rsnapshot.pid # release lock
M [01/Jan/2012:23:30:02] /bin/rm -rf ... # start the delete
D [02/Jan/2012:00:00:04] /usr/local/bin/rsnapshot daily: started
D [02/Jan/2012:00:00:04] echo 83352 > /var/run/rsnapshot.pid # get lock
D [ a bunch of 'mv's, rsyncs etc ]
M [02/Jan/2012:00:07:34] /usr/local/bin/rsnapshot monthly: completed successfully
D [ some more rsyncs from 'rsnapshot daily' ]
D [02/Jan/2012:04:16:54] /usr/local/bin/rsnapshot daily: completed successfully
As you can see, 'rsnapshot monthly', which just handles rotates,
maintains a lock for under a second. Even though it's still deleting
the oldest monthly backup when the 'rsnapshot daily' starts, that's just
In summary, your cron jobs should run backup levels starting with the
least frequent going through to the most frequent, with short times
between them, and provided you use_lazy_deletes you'll be fine. My
crontab looks like this ...
0 0 * * * /usr/local/bin/rsnapshot daily
45 23 * * 6 /usr/local/bin/rsnapshot weekly
30 23 1 * * /usr/local/bin/rsnapshot monthly
So on those occasions when I run a daily, a weekly and a monthly on the
same day they're 15 minutes apart. 5 minutes, or even 1 minute would be
David Cantrell | http://www.cantrell.org.uk/david
It wouldn't hurt to think like a serial killer every so often.
Purely for purposes of prevention, of course.
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
rsnapshot-discuss mailing list
rsnapshot-discuss < at > lists.sourceforge.net