Upgrading zoneminder - Beware!

Support and queries relating to third party Live CDs and DVD, VM images and other packaged distributions
Post Reply
Flasheart
Posts: 342
Joined: Thu Jul 06, 2006 2:27 pm

Upgrading zoneminder - Beware!

Post by Flasheart »

Valid for 1.24.3 in debian repositories. Wiped an entire database of events on one machine; almost a terabyte of recorded images going back a month, including archived events.


If you use symlinks to put your zoneminder data on a different drive or mount, be VERY careful when upgrading zoneminder.

This happened to me using standard debian reps;

apt-get update && apt-get upgrade

(bunch of stuff, including zoneminder)

dpkg silently *removes* the symlinks in /usr/share/zoneminder for ./events and ./images which pointed to the new drive and replaces them with new directories.

These directories are of course empty, and when zmaudit.pl runs it cannot find the images for events and deletes the events from the database, eventually deleting your entire events database and resetting your events drive to whatever /usr is mounted on. In my case, that's the root drive which promptly filled up and halted the system. (zmfilters prune events at 95%, but I had a scheduled backup to that drive which filled up the remainder too fast for zmfilter to cope and everything ran out of space)

As far as I know, there is no way to repopulate the event database just from the filesystem, so although I still had the files on the data dir, they were not organisable.

Not good.

I've raised this as a packaging bug with debian - http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=608793

Vagrant has confirmed and suggested as a workaround a different way of mounting instead of using symlinks and I have now changed my five zm servers to this new method. I've also updated zm's wiki article at http://www.zoneminder.com/wiki/index.ph ... Hard_Drive

Essentially it hard mounts the data drive instead of symlinking it, so the events and images dirs appear like normal dirs and dpkg *shouldn't* delete them..

Quick howto, assuming your data drive is already mounted on /data and your existing dirs are in /usr/share/zoneminder/

Backup your zm mysql database.

edit /etc/fstab and add

/data/images /usr/share/zoneminder/images none defaults,bind 0 2
/data/events /usr/share/zoneminder/events none defaults,bind 0 2

Save and quit.

zmpkg.pl stop (Halt zoneminder first!)
cd /usr/share/zoneminder
rm events (This is the symlink)
rm images (This is the symlink)
mkdir events
mkdir images
mount /data/events
mount /data/images

ls events Should show the same as /data/events - ie, two dirs per monitor, one numerical and a human readable symlink)

In ZM's web interface, check some recorded events to ensure thumbnails are working to show zm can see the recorded images.

zmpkg.pl start
Post Reply