9

I have two external hard drives (ExFAT formatted) which I need to keep in sync. Specifically, drive B must mirror the contents of drive A and drive A must not be modified. How can I do this without having to do a full copy of drive contents every time? I'm on OS X 10.10.

This is simply for periodically backing up the contents of drive A.

  • Not sure if you want to invest in a nas, but I use a synology DS214+ nas with 2 drives in it. One drive is a backup of the other. Raid. – Jules Jan 1 '15 at 18:43
  • @Jules - a RAID is not a backup – user151019 Jan 1 '15 at 18:44
  • @Jules Thanks, but I'm only looking for software solutions now. – Szabolcs Jan 1 '15 at 18:45
  • @Szabolcs Do you already use Time Machine to backup your Mac? – klanomath Jan 1 '15 at 19:10
8

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?.

  • I was under the impression that rsync can't delete files. It seem that's not correct then. I don't need (or want) to schedule it, as the disks are not always connected. I can run it manually. – Szabolcs Jan 1 '15 at 20:45
  • Easier, just execute the command when you need to, and you are done. – jherran Jan 1 '15 at 20:48
  • Shouldn't that be /Volumes/DiskA/ instead of /Volumes/DiskA? I tested it on a small folder and it creates the folder name of the source in the destination otherwise. – Szabolcs Jan 1 '15 at 21:01
  • You are right. My mistake. – jherran Jan 1 '15 at 21:04
  • If after running the command you don't see any changes, e.g., files that shouldn't be in DiskB are still there, try using sudo like this: sudo rsync -av --delete /Volumes/DiskA/ /Volumes/DiskB/ – Esdras Lopez Mar 8 '18 at 6:29
1

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.

1

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/

  • $8 is much more reasonable than the price of the other tools mentioned and I do prefer a graphical tool to typing in rsync commands (which carry a risk of making a typo as small as leaving off a / and completely messing up the harddrives). Does it support deleting files in the destination directory? – Szabolcs Jan 2 '15 at 0:53
  • @Szabolcs Yes it does, I use it to keep an exact copy of folders from my hard drive over an ethernet connection to my wife's computer. If I delete files then sync they are deleted on her computer as well. You also get a preview of what files will be copied and which ones will be deleted before you commit to it. – amergin Jan 2 '15 at 23:49
0

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

You must log in to answer this question.

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