Home » Mac OS » Synchronising two external hard drives with rsync on a mac

About Patrick Kua

Patrick Kua
Patrick Kua is an author, speaker and consultant who still finds time to code. He works as an active, generalizing specialist at ThoughtWorks and dislikes being put into a box. He is often found leading technical teams, coaching people and organisations in lean and agile methods, sometimes facilitating situations beyond adversity. Patrick is fascinated by elements of learning and continuous improvement, always helping others to develop an enthusiasm for the same.

Synchronising two external hard drives with rsync on a mac

This is more of a reminder for myself so I don’t need to keep googling or looking at man when I need to look up the syntax.

Let’s assume you have two hard drives, ones called PHOTOS the other other PHOTOS_BACKUP. You can use the following command to sychronise photos (including removing all files that were deleted on PHOTOS to PHOTOS_BACKUP.) also ignoring backup files (.* files).

rsync -av --delete --exclude=".*" /Volumes/PHOTOS/ /Volumes PHOTOS_BACKUP

It’s nice to test this on a smaller folder first if you like. You should note the slash and lack of slash matters. To do a dry run try:

rsync -avn --delete --exclude=".*" /Volumes/PHOTOS/ /Volumes PHOTOS_BACKUP

or alternatively:

rsync -av --dry-run --delete --exclude=".*" /Volumes/PHOTOS/ /Volumes PHOTOS_BACKUP

Happy backups!

Published on System Code Geeks with permission by Patrick Kua, partner at our SCG program. See the original article here: Synchronising two external hard drives with rsync on a mac

Opinions expressed by System Code Geeks contributors are their own.

(0 rating, 0 votes)
You need to be a registered member to rate this.
Start the discussion Views Tweet it!
Do you want to know how to develop your skillset to become a sysadmin Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. Introduction to NGINX
2. Apache HTTP Server Cookbook
3. VirtualBox Essentials
4. Nagios Monitoring Cookbook
5. Linux BASH Programming Cookbook
6. Postgresql Database Tutorial
and many more ....
I agree to the Terms and Privacy Policy

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of