Using remote rsync, but copy locally?

I'm looking to use rsync to compare remote files and to copy the diff to a local directory, rather than transfer over the net.

The net connection is not fast enough to transfer these files (~1.8TB) and I'd like to sneakernet them instead.

Possible?

Certainly you can rsync locally. Omit the user@host: part of the src/dest, and the rest stays the same. rsync [...] ./dir1 ./dir2

Be sure you get the permissions and timestamps preserved right when you carry over the files.

I think he means "compare to remote, but don't copy the files over". In that case, use the --only-write-batch option of man rsync (Linux), in addition to any other options. It will create 2 files, a shell script (really only 1 line) to apply the differences, and one larger containing the changed/missing files in some sort of stream.

2 Likes

pludi: That is exactly what I was after. Thank you so much!

I just found a page discussing the usage:

rsync --only-write-batch=/mnt/usb/batchfile
move USB stick to remote side
rsync --read-batch=/mnt/usb/batchfile

I have to do some experimenting, but this seems to be really close to what I'm aiming to do.

I've now got this working locally, but I need to be able to execute from a remote host.

This works on the source system:

rsync -av --only-write-batch=/mnt/usb/batch --stats /mnt/sync_sandbox/ remote-system.com:/mnt/sync_sandbox/ 

But this does not when run from the remote host, since it appears the the batch is relative to the system where the rsync originates:

rsync -av --only-write-batch=/mnt/usb/batch --stats source-system.com:/mnt/sync_sandbox/ /mnt/sync_sandbox/ 

Is there an easy way to get this to execute correctly? My source system doesn't have direct access to the remote system. I must originate the connection from the remote system to the source.