Development notes

Thoughts, notes and ideas about development

Rsync: How tobackup local iCloud folder to Synology

2021-12-10 2 min read Backups

This post describes how to backup a local folder from iCloud to a Synology NAS using rsync.

rsync is a console tool that copies files either to or from a remote host or locally on the current host (it does not support copying files between two remote hosts).

Prepare Synology

First, we need to enable the rsync service on the Synology. Open Control Panel, File Service and rsync tab.

enable-rsync-synology

In the Control Panel, go to the Shared Folder and create a folder for saving our backup with appropriate permissions.

Backup our local folder

In general, the command for backup looks into the following way:

rsync -azP  <source-folder-path> <synology-login-username>@<synology-ip-addr>:<dest-folder-path>

Let’s assume I want to back up the Books folder from my Mac’s local iCloud folder to the remote bkps folder on Synology. The full command will look into the following way:

rsync -azP /Users/myMacUser/Library/Mobile\ Documents/com\~apple\~CloudDocs/Books [email protected]:/volume1/bkps

where

  • /Users/myMacUser/Library/Mobile\ Documents/com\~apple\~CloudDocs/Books is a local folder in iCloud
  • mySynologyUser Synology user.
  • 192.168.1.100 Synology IP address in my local network
  • /volume1/bkps remote folder on Synology for saving backups

Options explanation

  • -a, --archive archive mode; same as -rlptgoD (no -H)
  • --progress show progress during transfer
  • -P same as --partial --progress
  • -z, --compress compress file data during the transfer

If we need to copy/transfer only files to the remote folder without creating the Book folder on the Synology, add a trailing slash after the Books folder, like long-path/Books/.

More detailed explanations and examples from the rsync’s documentation:

rsync-documenations

More documenation can be found via

man rsync
comments powered by Disqus