I am currently configuring Dirvish on a Linux computer for backing up the contents of a share on a Windows computer.

Dirvish creates a new directory every time it is called. It internally uses rsync for copying data, creates hard links for files that have not changed and copies those that have.

Normally, from Linux to Linux, it uses rsync over ssh where rsync is running on both sides of the connection so for those files that already exist, only a checksum is transferred which is pretty much instant even for large files.

When used on a Samba share, there is no rsync on the other computer so does rsync still provide any advantage over plain copy where network traffic is concerned?

Why use rsync instead of cp?
First, I wanted to quote Tim Morgan, who wrote three arguments on his blog post a few years ago, favoring rsync over cp:

  • It can be canceled in the middle, and resumed later.
  • It can show a progress bar that (while not perfect) is great for large files or lots of files.
  • It will only copy the changed files and won’t clobber already existing directories of files at the target.

rsync uses by default less traffic than cp, even on samba shares
In terms of network traffic, cp always copies the file contents, while rsync doesn't. The default behavior of rsync (see man page) is that it checks the file size and modification date/time. If those two attributes are the same, rsync assumes that the file is unaltered. This also works on Samba shares. This behavior can be changed using the -c or --checksum flag, which forces rsync to always do the check based on the checksum.

rsync -c uses (a little bit) more traffic
If you use the -c flag with rsync, there is the overhead of sending the filelist, which rsync does, but cp doesn't, so I think (not tested) rsync had a (very!) little bit more overhead than cp if rsync is used with the -c flag.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.