Welcome! » Log In » Create A New Profile

Rsnapshot rotating but no smaller interval ready

Posted by Anonymous 
Rsnapshot rotating but no smaller interval ready
June 02, 2015 12:12PM

I've used rsnapshot for a while now and I noticed that rsnapshot rotates, although a lower interval is not present. I believe this is a bug, or at least produces results that are less favorable than my suggestion below.

- What I try to run:
rsnapshot weekly

- What are the circumstances:
I have a backup dir with daily.0 up to daily.5. There is also a weekly.0 present. (last run moved the daily.6 to weekly.0) - all is fine.

- Expected output:
/home/sync/daily.6 not present (yet), nothing to copy

- Instead I get:
mv /home/sync/weekly.0/ /home/sync/weekly.1/
/home/sync/daily.6 not present (yet), nothing to copy

- The problem:
This leaves me with a weekly.1 directory, possibly ready to be rotated even further to weekly.2, 3, etc... up until the moment a fresh daily.6 is made and a new weekly.0 can be created. This means we could end up with weekly.0, weekly.2, weekly.4... rather messy and I'd say unneeded rotations.

- My suggestion:
Shouldn't the "nothing to copy" check (looking for existence of lower_interval.max) happen BEFORE it rotates all the other directories? It's less destructive than just going ahead with the rotation and THEN finding out about the fact that there is no daily.6 to move to weekly.0.

This will also prevent unnecessary gaps between weeklies and keep the directory structure cleaner.

- What you could be asking yourselves:
Why on earth would you run weekly before daily.6 is made? Answer: it could just happen... in my case, I use "rsnapshot-once" wrapper. This makes sure that rsnapshot rolls back if it fails. This is ideal for my laptop. Sometimes I shut it down when I'm on the move and this kills rsnapshot. The wrapper makes sure dirty backups get cleaned up. This also means that I need to have a cron job that runs multiple times. E.g. my weekly runs every day! The wrapper checks the timestamp and only runs when the weekly is >a week old. Hope this explains a little bit my situation.

Kind regards,
Sorry, only registered users may post in this forum.

Click here to login