rsnapshot push TO the server FROM the client

I have found out that rsnapshot is great tool for backing up my stuffs for local file system. Now I need to do rsnapshot_push.conf file where I give params to rsync server. What is the right way to do this? Can I use rsync to /rsnapshot-backups/localhost/ syncing it to rsync server.


Rsnapshot is pull-based by design. The power of Rsnapshot lies in using hard links, and that only works for local file systems. (nfs could be used as it supports hard links, but not for instance sshfs).

In a push scenario, the best solution is to simply push to to a backup directory on the server using rsync, and then allow rsnapshot handle snapshotting from that directory, as it was designed to. Rsnapshot doesn't care if changes were introduced by an rsync or by saving a file.

In the rsnapshot FAQ there is a fancy solution that triggers rsnapshot after the rsync, but that could be overkill. Just running rsnapshot from its recular cron jobs works just as well.

An alternative solution is rdiff-backup, however this does not present a nice directory view of each snapshot and requires running commands to restore files, which may complicate fast restoring.


Another option is to use a reverse ssh tunnel and then to a "remote" pull from the receiver's side:

#!/bin/bash -x
IVAL=${1:-hourly}
ssh -vNR 1998:localhost:22 example.com &
ssh example.com "rsnapshot -c pull-from-sender-rsnapshot.conf ${IVAL}"

where pull-from-sender-rsnapshot.conf might contain a line like:

backup localhost:1998/etc/  desktop-1

This could be invoked by cron on the sender's side, triggering the remote rsnapshot locally.


I developed rsnappush specifically to solve same problem you're encountering, and actually came across your post because I was looking for a pre-built solution (that didn't exist yet).

SYNOPSIS

rsnappush [-h] [-r RSYNC_OPT] [-q] SOURCE_PATH [ACCOUNT:]DEST_PATH

DESCRIPTION

rsnappush is a wrapper around rsync(1) to assist in file-level incremental snapshots that are pushed to a destination. Unchanged files are hard-linked. Files are plainly laid out in a directory for each snapshot: DEST_PATH/backup-YYYYmmdd-HHMM/ for easy access and restoration.

SOURCE_PATH is any local path.

DEST_PATH is a path, local or remote. If remote, ACCOUNT specifies an ssh(1)-compatible account description, such as USER@HOST.

Additionally, under DEST_PATH there is a permissions/ directory created that has compressed output from getfacl(1). setfacl(1) can be used to restore permissions from this file once it is uncompressed.

EXAMPLE

rsnappush --rsync-opt=--partial-dir=/home/user2/rsync-partial \
          /home/user user2@remotehost:backups/