Skip to content

Instantly share code, notes, and snippets.

@iUltimateLP
Last active April 14, 2026 19:54
Show Gist options
  • Select an option

  • Save iUltimateLP/614cb0ce8606ec8979c903a03535762f to your computer and use it in GitHub Desktop.

Select an option

Save iUltimateLP/614cb0ce8606ec8979c903a03535762f to your computer and use it in GitHub Desktop.
Simple Bash script example that creates bind mounts for Synology Photos so you can keep your original folder structure ๐Ÿ“ธ
#!/bin/bash
# This is an example script which creates bind mounts to mount certain directories to the Synology Photos home directory
# A potential use case would be:
# you're having your own folder structure somewhere else, which you want Synology Photos to be aware of,
# but you don't want to copy/move all the files to Photo's home directory (because as of right now,
# Photos unfortunately only scans media in either "/volume1/homes/<user>/Photos" for personal storage
# or "/volume1/photo" for shared storage
# NOTE: these bind mounts don't survive a NAS restart. I recommend scheduling this script as a task in Synology DSM:
# 1. Go to the control panel
# 2. Open the Task Scheduler
# 3. Create a new triggered "user-defined script" task
# 4. Name it whatever you want and select "boot-up" as the trigger event
# 5. Select "root" as the executing user (required to create bind mounts, but please please verify what you're really putting in this script, since it runs with root privileges)
# 5. Under "Task settings", enter the following text under user-defined script (and of course replace the path to where the .sh is actually located):
# /bin/bash /volume1/Path/To/synology_photo_mounts.sh
# Now, the script is executed every time the NAS is started, making sure the bind mounts exist. Fortunately, when they don't, Photos won't just forget about the lost media but displays it in a broken state. Once the mounts are available again, it will continue to work.
# Bind mounts are bidirectional, meaning that any edits, such as you deleting a photo from Synology Photos, will also be applied to the bind source. They're essentially just a symbolic link to files that lie elsewhere. That's something to keep in mind.
# Once these change, you need to trigger a manual rescan from within Synology Photo's settings.
# Below are a few example commands - adjust them as needed
# Mirror the "Backups/My Android" folder to the "My Android" folder visible to Synology Photos
# This mount is visible for the user <username> only, since we're mirroring in the Photos directory of that user only
mount -o bind "/volume1/Backups/My Android" "/volume1/homes/<username>/Photos/My Android"
# Mirror the "PhotoVideo/Vacation" folder to the "Vacation" folder
# This is a shared mount, meaning all logged in Photos users can see the folder in their "shared area" Photos
mount -o bind "/volume1/PhotoVideo/Vacation" "/volume1/photo/Vacation"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment