Why does rsnapshot's sync/sync_first command backup ALL my files everytime?

5

2

I'm trying to get rsnapshot working for remote backups (via ssh). I have a working configuration and I can perform all my backups.

In my conf I have enabled sync_first=1. As I understand it, this means that I have to always first run the rsnapshot sync command to actually go and grab the backup files first, then run the rsnapshot hourly command to simply symlink and rotate the backups.

Now the problem. I'm not sure if this is by design, but I am noticing that every time I run rsnapshot sync, every file on my remote machine it being backed again regardless of whether it has changed since the last backup. This means the rsnapshot sync command takes > 1hr.

Is this the designed behaviour?

Should I be running sync every hour before running hourly/daily/weekly?

Timmy O'Mahony

Posted 2014-11-13T14:29:55.853

Reputation: 123

Answers

2

Yes, you should be running sync first. sync synchronizes to the .sync directory. hourly then rotates away .sync to hourly.0. The nice thing is that you can run rsnapshot sync again, after an interrupted rsnapshot sync, and it will continue where it left off.

I have this in my crontab:

# make backups every 2 hours - and skip hourly backups at night
0 0,6,8,10,12,14,16,18,20,22 * * * /opt/bin/rsnapshot sync && /opt/bin/rsnapshot hourly

# rotate a daily every night at 5
0 5 * * * /opt/bin/rsnapshot daily

Do note that, in the above crontab, if rsnapshot sync produced warnings, but could still finish the backup, it will return with an error code of 2. That means that rsnapshot hourly will not run. If this happens every time, then you don't have any hourlies, nor dailies - just the .sync directory.

Frank Kusters

Posted 2014-11-13T14:29:55.853

Reputation: 143

How is your BACKUP INTERVALS configuration in /etc/snapshot.conf ? – rubo77 – 2016-07-10T07:14:45.737

I seem to have no problem here, but I use only daily backups: http://serverfault.com/questions/788992/configuring-rsnapshot-to-only-daily-backups-with-sync-first

– rubo77 – 2016-07-10T10:11:59.690

@rubo77 You can find the full configuration in this Github gist.

– Frank Kusters – 2016-07-11T13:40:35.323

Should I run sync before smallest interval or before all and why? – Mindau – 2017-01-03T21:17:35.967

@Mindau Before the smallest interval, because the smallest interval rotates the .sync directory to <smallestinterval>.0. – Frank Kusters – 2017-01-03T21:52:13.497

@FrankKusters and what rotates to bigger interval? – Mindau – 2017-01-03T22:07:29.143

1

@Mindau I advise you to read the How it works section of rsnapshot's documentation. It's only one screenful and not very technical.

– Frank Kusters – 2017-01-04T06:30:13.493