How to synchronize contents of two external drives?

You could use rsync like this:

rsync -av --delete /Volumes/DiskA/ /Volumes/DiskB

--delete option is for delete files in DiskB that was previously deleted on DiskA.

If you want to schedule it to execute periodically, I suggest you to read How can I run/stop/relaunch an application automatically, at boot/login/some other time?.


rsync is certainly one way to go. The other is to use something like SuperDuper or CarbonCopyCloner which can do drive cloning/mirroring. Also, ChronoSync might be an option as well, if you need to keep track of deleted contents for any reason.


I use DropSync and have done for ages - does what you need and more and costs $16 from the developer or $19.99 from the Mac App Store.

http://www.mudflatsoftware.com/


I would go for Unison. It's a tool that simplifies keeping two folders in sync.

Install it via Homebrew:

brew install unison

Then call it with the two drives as arguments:

unison /Volumes/A /Volumes/B

Follow the instructions and make sure to read the manual. There are some tips for macOS here. For example, I've created a preference file in ~/.unison/default.prf with the following contents to exclude metadata and resource forks:

ignore = Name {Cache*,.Trash*,.VolumeIcon.icns,.HSicon,Temporary*,.Temporary*,TheFindByContentFolder}
ignore = Name {.AppleDesktop,.AppleDb,TheVolumeSettingsFolder,.Metadata,.filler,.idsff,.Spotlight,.Spotlight-V100,.DS_Store,.CFUserTextEncoding}
rsrc = false
ignore = Name .FBCIndex
ignore = Name .FBCLockFolder