Synology security video backup to Google drive

I have battled to get my Synology DiscStation to do somethiong that I thought was pretty simple.  Its a DS214play running DSM 5.2.  I use Surveilance station to record motion activated video of the driveway at the front of the house.  This documents everyone arriving and leaving and has been pretty reliable for some time.  However I wanted to automatically backup this series of short video files to a cloud storage provider – I’m using Google.

The Synology has a tool called CloudSync which can do this sort of thing but it failed to backup the security video because it is kept in a series of folders owned by root and there is a permissions conflict.  A less direct route was required and I hit on the idea of copying the automatically recorded files to an easier part of the filesystem to access, to change the permissions and then to upload them.

So I hit the terminal. Interestingly ssh login as root is allowed but sudo is not.  An unusual combination that took me some time to puzzle out.  I created a directory owned by an ordinary user:

mkdir /volume1/DS/security
mkdir /volume1/DS/scripts
chown melba security
chown melba scripts
touch /volume1/DS/scripts/
chmod 770 /volume1/DS/scripts/

Now I set up a recurring task in the diskstation front end to run the script at /volume1/DS/scripts/ every minute to accomplish two things.  Firstly to move the inaccessible security footage from a set of directories owned by root into an accessible area owned by melba, and, secondly, to alter all the files and directories to make the owner melba.  This will allow me to back them up with CloudSync.  The file therefore looks like:


# Variables

rsync -ra "$FROM" "$TO"
chown -R melba:users "$TO"
/usr/syno/bin/synologset1 sys info 0x11100000 "Security footage has been synchronised."

The last line there was the result of a little googling to allow logging of the running of the little script, largely for my own peace of mind. Thanks to the kind user whose post I’ve mislaid! The first time I ran the rsync command the system hummed away for about 10minutes but subsequently the sync takes a second or two.

The final stage is to set up a task with the CloudSync tool on the DiskStation.  This is a one way sync to my Google Drive which makes all the footage available off site and also in the event that the DiscStation is stolen.  I’ll need to report back on the latency of the system.

Leave a Reply

Your email address will not be published. Required fields are marked *