Backups

From ZoneMinder Wiki
Jump to navigationJump to search

General notes about backups:

Zoneminder requires the filesystem to be backed up, AND the Database. It can be backed up whilst running (if you can accept the odd missing event taken during the backup).


Backing up

A typical backup would be to dump the mysql database "zm" and also the events directories. Because of the size of both of these in an active system with many cameras, this may require a LOT of space. The events won't compress well, being JPGs (already compressed) The event directory is build and distro dependant, but on a typical debian install will be in /usr/share/zoneminder/events

ZM's main configuration is kept in the mysql database, although some basic settings are typically held in /etc/zm (debian)

How often you do this is up to you, but consider CPU load during backup, and length of backup. It's not unknown for a highly stressed server to be overwhelmed with a large backup.

"backup-manager" is an excellent program that will do both database and directories, and sequentialise them as you wish, keeping only the N most recent. It can transfer them offsite too.

Because of these complexities, some zoneminder admins do not do do regular backups, preferring to archive and export as video any events they particularly want to keep as they occur.


Offsite Live Backups

Occasionally an admin realises that because the server recording CCTV is housed at the same location it is recording, should a burglary take place the thieves are likely to take the shiny server while they're at it, even if they don't realise it's acting as a cctv recorder. It's hard to dispute this logic. However, because of the amount of bandwidth a medium sized zoneminder install requires, offsite backups may be difficult to achieve using consumer grade technologies. A professional thief may also cut phone/data wires or power before gaining entry.


Some thoughts to formulating your plan...

  • Hide the server! Make it hidden. Cupboards, in loftspace, an outbuilding, etc. Consideration should be given to heat dissipation, dust, acessibility and noise - but this is a low cost and often effective low-tech solution.
  • Record offsite. You can use existing technologies like NFS to mount a remote drive to your local server, and change your events/ do to live on that. The downside is fairly obvious - you will need a LOT of upstream bandwidth to cope with anything but the most basic of installs. Of course, you will also have to formulate a plan for keeping the database up to date too, unless you want a lot of manual digging through directories to find the files you want.
  • Record selected cameras from a remote server. Either using IP cameras, or having Zoneminder locally acting as a transcoder (you can record from a zoneminder monitor), have a remote server recording 1 or 2 cameras so you at least stand a shot. This is also a highly configurable system allowing for you to adjust FPS, size and colour to suit your upstream.
  • Synchronous backup. In theory it's possible to set mysql to replicate to a slave database offsite, and have rsync (or similar) constantly synchronising the events/ dir. Given the large file directories (deep or not), I have no idea how rsync will cope constantly syncing such a large filesystem with regard to both local cpu and io load, and bandwidth. If you have experience of this, please expand this article.