Rsync music and pictures to your Synology DiskStation without losing thumbnails and metadata
I currently keep photos and music on my desktop computer and my Synology DiskStation NAS. I sync them from my desktop computer to the DiskStaion using rsync (or sometimes Grsync when I’m in the mood of using a GUI).
To remove deleted files also from my DiskStation I’m passing the --delete
option to rsync. But when I first did this I found out rsync was removing all the hidden “@eaDir” subfolders the DiskStation created for storing thumbnails, album covers and metadata. This caused the DiskStation to recreate all the thumbnails again (if you store many photos on your DiskStation you know this process takes days).
I checked the available exclude and filter options of rsync and found a pretty good way to avoid this problem. Using a filter to ignore the “@eaDir” subfolders on the remote side fixed the problem, but adding just a filter is still problematic because rsync would leave empty folders (well, not really empty – folders with “@eaDir”) on the DiskStation when deleting folders on the desktop PC. But there’s an elegant way to solve this: the “perishable” filter option (which I found in this blog post). This filter option ignores the filter rule when a folder gets deleted.
This is the rsync command I currently use to sync my photos to the DiskStation (with dry-run enabled by the -n
parameter):
rsync -r -n -t -v --progress --delete --filter="-p @eaDir" /home/raphael/Pictures/ raphael@DiskStation:/volume1/photo/Raphael
Make sure to adjust the path to your needs and do a dry-run (activated with the -n
option in the line above – where rsync only reports which files it would transfer/delete without any actual sync) to make sure everything works as expected before running the real sync. If everything looks good, remove the -n
option.