I like roaima's answer, but the paths are the same in both examples, obscuring which is which. We've established that the following doesn't work:
rsync -vuar host1:/host1/path host2:/host2/path
But this does (I omitted the explicit bind_address of localhost from the -R
option since that's the default):
ssh -R 50000:host2:22 host1 'rsync -e "ssh -p 50000" -vuar /host1/path localhost:/host2/path'
Note that you'll have to have ssh keys set up correctly between the two remote hosts, with the private key on host1 and the public key on host2.
To debug the connection, break this into two parts and add verbose status:
localhost$ ssh -v -R 50000:host2:22 host1
If this works, you'll have a shell on host1. Now try the rsync command from host1. I recommend doing this in a different window so the verbose ssh info doesn't get mixed together with the rsync status info:
host1$ rsync -e "ssh -p 50000" -vuar /host1/path localhost:/host2/path
sshfs
is that thenrsync
sees the source and destination filesystems both as local, so it disables its delta algorithm. At that point you almost might as well just usecp -p
. See the answer that proposes this and its subsequent comments. – roaima Feb 9 '18 at 8:59