I've got this scenario: dir1 /home/arek/
, dir2 /mnt/home/arek/
(mounted with sshfs).
When I issue: rsync -avz /mnt/home/arek /home/arek
, I get /home/arek/arek
with the whole content. Some directories are OK in /home
, some are not. There are no links (neither hard nor symbolic).
Does anybody know what is going on and how to protect myself?
Best Answer
rsync(1)
is picky about the trailing slash. Try this:See the mainpage for all the details.
Update
If one of the paths is mounted via sshfs, I suggest using
rsync(1)
differently:(The
-e ssh
might be redundant at this point;rsync(1)
used to default torsh
!)The
-P
asks for partial file transfers to be restarted (very helpful on network links that might die) and shows progress (which is helpful over network links, since they are frequently slower than drive-to-drive copies).Furthermore,
rsync(1)
is very clever about doing hashing checks on both endpoints when invoked this way -- disk to CPU bandwidth is much better than disk tossh
to network tossh
to wonky filesystem driver bandwidth -- so you will be transferring much less data across the network.Consider: if you append a single byte to every file,
rsync(1)
over sshfs will be forced to transfer the contents of every single file from the source to the destination.rsync(1)
overssh(1)
will instead start anrsync(1)
on the remote endpoint and do the hashing computations on both machines as necessary, and will probably only transfer the last 8192 bytes of every file.