Rsync over SMB

This is a short one — I was using rsync to back up about a terabyte of data, which suffered a number of interruptions. Each time it restarted, I noticed it was copying over the same files over and over again. As it turns out, SMB rounds off the time stamps to the nearest two-second interval, so when rsync compares timestamps, it believes the file is different.

There’s a simple solution:

rsync -rlptDv –modify-window=1 [source] [destination]

The “–modify-window” switch tells rsync to relax its timestamp comparison just enough for it to behave.

The remaining switches are useful for backing up to a NAS box, it’s essentially -a (archive mode) expanded, but without preserving ownership or groups (which doesn’t work well on the NAS.)

Share
Tagged , , . Bookmark the permalink.

3 Responses to Rsync over SMB

  1. Kevin says:

    Thanks for the help. This was causing me issues for an hour or so until I found this.

    FYI that is a double-hyphen — before modify-window, it appears based on the font to be a single hyphen.

  2. jbroome says:

    High-five! This is what i needed to go from my linux box to win2k3 server. Thanks a bunch.

  3. AdSR says:

    When uploading this way from Linux to Win7 I had to drop the -lpD switches. Otherwise it just creates empty directories while reporting success. Still, thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

By submitting this form, you accept the Mollom privacy policy.