2

I am trying to synchronise two different folders using rsync. I have copied all the data worth 4Tb from a network share to an external hdd using rsync -v -r /source /destination. Now I need to run regular backup to sync both the locations. Can anyone suggest rsync command which I can use to synchronise both the folders.

  • 1
    By synchronize, you mean that changes can occur both on the network share and on the external HDD and you want to sync them both ways? – nohillside Dec 30 '15 at 15:55
  • @patrix Yeah the destination folder should get updated from the source folder when i use the rsync command. So after running the command it should look for those files which has been updated on the network share and copy it on the destination. – huseinasj Dec 30 '15 at 16:09
  • I think that the best way to do that is using cron. In cron you can specify to execute rsync all days at 8.00 am and 8.00 pm (for example). Doing that way you will have always a copy in both of them. – user161254 Jul 19 '16 at 16:18
  • @huseinasj: could you please completly reply to @patrix question. You have 2 locations of data: a /source and a /destination. When you talk of synchronisation, do you mean a one-way: source → destination or a two-way: source ⟷ destination? The both within your final question is leading to a clear confusion. – dan Aug 8 '16 at 16:24
  • Note that you will need to copy extended attributes as well for full functionality – Thorbjørn Ravn Andersen Oct 2 '18 at 8:53
1

The best way is to continue to use rsync so as to maintain /destination synchronized with /source.

1st run:

rsync -avE /source /destination

next runs:

rsync -avE /source /destination

The -a option = --archive == -rlptgoD.

The -E option means copy extended attributes and ACL, and is mandatory on HFS+ filesystems.

Warning: the standard version of rsync on OS X, version 2.6.9 (see rsync --version) still have problems with extended attributes. These problems will be shown thanks to the -v option.

A verification of the output of rsync is mandatory.

This version 2.6.9 is too old and causing too many problems.


I advise any user willing to maintain in sync directories between different Macs (or between a Mac and another Unix machine) to install rsync version 3.1.2.

Here is the method I use:

  1. install MacPorts: MacPorts home page

    • go to the Quickstart section, install Xcode
    • choose the right version to install (Mavericks, Yosemite or El Capitan)
  2. Upgrade your PATH so as to find the port command in it for example, I installed it in /local/bin and modified my PATH like this:

    PATH=/local/bin:${PATH}
    export PATH
    
  3. Install rsync 3.1.2:

    port install rsync
    

With this version of rsync, the right options to use will be:

rsync -avAX /source /destination

and if you read me thus far, you are pretty good enough now to read

man rsync

to get the light from the source.

  • Can you provide (or link to) a simple instruction guide to install rsync 3.1.2 for those of us not very familiar with Terminal? Is this method reliable? gaborhargitai.hu/upgrade-rsync-on-mac-os-x – UncaMikey Aug 8 '16 at 19:11
  • Yes that is a pretty simple and correct documentation. But be warned, you have to get familiar with not Terminal but command line interface if you want to improve command line environnment. – dan Aug 9 '16 at 6:03
  • rsync 3.1.2 is also available from homebrew and you might find it simpler to install. Just these two lines: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" and brew install rsync – Michael D. M. Dryden Aug 9 '16 at 6:33
  • Thanks for the suggestion. I ran the homebrew install, which was successful. But when I did the second command, install rsync, I got this: "Error: No available formula with the name "rsync" ==> Searching for similarly named formulae... These similarly named formulae were found: grsync librsync vdirsyncer " Homebrew then suggested I run the command "brew install homebrew/dupes/rsync" which I did. Installation seemed to be successful but when I do rsync --version I still get 2.6.9 How do I get 3.1.2 to take its place? – UncaMikey Aug 9 '16 at 16:26
  • I tried running the original rsync install cmd again and got this: brew install rsync Warning: homebrew/dupes/rsync-3.1.2 already installed – UncaMikey Aug 9 '16 at 16:29
-3

Easiest way to update rsync on MacOS Mojave as described at the following link.

https://bayton.org/2018/07/how-to-update-rsync-on-mac-os-high-sierra/

  1. Open the terminal and paste the command:

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. Now you are ready to install the new Rsync version, and can do so as follows:

    brew install rsync
  3. Once completed, you should sign out and back in to MacOS.

When entering the command below, you will see now that you are using rsync 3.1.3 (at time of writing), instead of rsync 2.6.9. You are no longer running a 12 year old version of Rsync!

<pre>rsync --version
rsync  version 3.1.3  protocol version 31</pre>

As simple as that.

  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – grg Oct 23 '18 at 20:24
  • My reply included the text information needed. See original. "Easiest way to update rsync on MacOS Mojave." – august Oct 24 '18 at 21:03
  • A link to a potential solution is always welcome, but the answer should actually contain an answer, not just directions towards the answer. Please quote the most relevant part of an important link, also in case the page goes offline. For more information, see Are answers that just contain links elsewhere really “good answers”? – grg Oct 24 '18 at 21:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .