(near) real-time backup solution?

afddwfadwfadwf

Young grasshopper
Joined
Mar 28, 2016
Messages
83
Reaction score
12
I am using 2 Hikvision IPC's writing directly to samba share. Any ideas on how to achieve (near) real-time backup of motion/alarm recordings? One obvious way is to have a remote device record to RTSP stream but that's quite bandwidth intensive for always on.

Anyone is familiar the directory structure of Hikvision IPC storage (datadirx)? Why would it make so many datadir's? I can't playback those individual recording segment files.
 

jasauders

Getting the hang of it
Joined
Sep 26, 2015
Messages
214
Reaction score
56
What OS is running the samba share? You could look into an OS-specific utility to ensure the data in the samba share is written elsewhere. On Windows, I'm unaware of a real time multi-directory sync. It may very well exist though. Best I can think of on Windows is something like FreeFileSync running a batch job via scheduled tasks (this is assuming scheduled tasks can run down to the minute -- not sure on that).

If Linux is running the samba share, look into lsyncd. The task of lsyncd is meant to ensure that what's in directory A is also in directory B. Directory B can be a network resource (mounted locally to the system via NFS or something), etc etc. Or if you want to go more of a scheduled route, you could whip up a quick rsync one-liner script and cron it to run every minute. Not as real time as lsyncd, but it'd be a quick and dirty alternative idea with a 60 second delay.
 

afddwfadwfadwf

Young grasshopper
Joined
Mar 28, 2016
Messages
83
Reaction score
12
If Linux is running the samba share, look into lsyncd. The task of lsyncd is meant to ensure that what's in directory A is also in directory B. Directory B can be a network resource (mounted locally to the system via NFS or something), etc etc. Or if you want to go more of a scheduled route, you could whip up a quick rsync one-liner script and cron it to run every minute. Not as real time as lsyncd, but it'd be a quick and dirty alternative idea with a 60 second delay.
running linux. I would like to backup only the last x hours instead of months of videos (too big). Not sure what to sync, there are so many datadir directories. Isn't syncing a partial segment pointless since it can't be played back?
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,687
Reaction score
14,056
Location
USA
I would like to backup only the last x hours instead of months of videos (too big).
You mean you want to auto-delete the backups after X hours? That throws all my ideas right out the window.

You should probably upgrade to an actual NVR. Or Blue Iris, which I know can back up clips to an FTP server once they are finished recording.
 

jasauders

Getting the hang of it
Joined
Sep 26, 2015
Messages
214
Reaction score
56
running linux. I would like to backup only the last x hours instead of months of videos (too big). Not sure what to sync, there are so many datadir directories. Isn't syncing a partial segment pointless since it can't be played back?
If you leverage mtime in your script, I wonder if you could target files of a certain age in part of an rsync command. This is just some guess work, not tested at all, but thinking something along these lines:

#!/bin/bash
find /media/surveillance/ -name '*.mp4' -mtime -7 -exec rsync -a --delete /media/surveillance/ user@192.168.X.X:/media/surveillance-backups {} \;
exit

If my guess work is correct, I suspect this would target all .mp4 files within /media/surveillance under the age of 7 days and rsync those over ssh to the 192.168.X.X box to /media/surveillance-backups. Using the --delete flag may offer some cleanup characteristics on the destination side as well. Cron that for every-so-often, etc etc.

If nothing else, might be an idea. Something to tinker with.
 
Top