Syncing external Backup Drives

Backup not found: (A)bort (R)etry (M)assive heart failure?

Backups take ages if you copy the whole directory even if only a few files changed. A much better way is to just copy the changed files, but Finder on the Mac makes this difficult. However, there is a fast Terminal prompt that works. It identifies and copies only the files that are changed, akin to what Apple’s Time Machine does.

Note: Working with the command line is incredibly powerful, but you can also easily do things you did not want to do and cannot undo. So be careful here — and no warranty for any of the information.

If you want to try out these kinds of backups, you can use the terminal command rsync.

To do so, pen the Terminal. You need rsync followed by some options, an source and a destination directory.

Useful options are:

--update transfers only new or newer files instead of copying everything
-a makes a backup so the timestamps are preserved
-v provides detailed information what happens
-r recursive, meaning it will go through subfolders
-h shows file sizes in a human readable format

in some cases:


Danger! This will delete any file in the destination directory that does not exist in the source directory

So taken together, a command could look like:

Notes External

rsync -avrh --update --delete /Users/NAME/Documents/Obsidian/Vault/ /Volumes/My\ USB/Backup/

This command would sync the contents of the Vault directory (and all subfolders, given that the option r was used) to the external volume «My USB» in the Backup folder.

Note that space characters must be masked with \ (for the space character in «My USB») and that there is a / at the end of the source and destination path.

This example also shows why the command line is so dangerous. Given that –delete is set, it will delete all files in the destination directory that does not exist in the source directory. Now imagine you gave the wrong directory. It would (I think) delete the files in it that are not part of the source directory (likely all, because it’s the wrong directory). Or if you accidentally switched the source and destination directories. It would replace your current local copy with the old backup and delete all files you have created since then.

And IIRC the deleted files do not end up in the Finder Trash.

So, yeah, both highly dangerous and a much more efficient way to do backups.

But in the end, it matters that you do backups, not how.

Happy backup’ing.