6

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
  • 143
  • 1
  • 9

1 Answers1

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.

rubo77
  • 4,680
  • 11
  • 45
  • 79
Frank Kusters
  • 161
  • 1
  • 12
  • How is your BACKUP INTERVALS configuration in /etc/snapshot.conf ? – rubo77 Jul 10 '16 at 07:14
  • 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 Jul 10 '16 at 10:11
  • @rubo77 You can find the full configuration in this [Github gist](https://gist.github.com/frankkusters/5bb28c4d1ce4aadd0ae1). – Frank Kusters Jul 11 '16 at 13:40
  • Should I run sync before smallest interval or before all and why? – Mindau Jan 03 '17 at 21:17
  • @Mindau Before the smallest interval, because the smallest interval rotates the `.sync` directory to `.0`. – Frank Kusters Jan 03 '17 at 21:52
  • @FrankKusters and what rotates to bigger interval? – Mindau Jan 03 '17 at 22:07
  • 1
    @Mindau I advise you to read the [How it works](http://rsnapshot.org/rsnapshot/docs/docbook/rest.html#how-it-works) section of rsnapshot's documentation. It's only one screenful and not very technical. – Frank Kusters Jan 04 '17 at 06:30