ZoneMinder Wiki – Wiki – Using a dedicated Hard Drive

On many installs you may wish to dedicate a hard drive or partition for Zoneminder events. There are many reasons why you may want to change the storage location – security, data segregation, preventing encroachment onto OS partition by zoneminder etc.

It’s not terribly difficult to do, but may be non-obvious to the untaught so here’s a brief guide.

Some commands here are based on Debian/Ubuntu installs

1. Become root or “sudo -s” to gain root privs.

2. Stop Zoneminder. “service zoneminder stop”, “/usr/bin/zmpkg.pl stop”, or “systemctl stop zoneminder”

3. Mount your new partition onto the root filesystem, ensuring it is automatically remounted at boot time by editing /etc/fstab — For the benefit of this guide, I’m calling my new partition /newdrive

Note this new partition can be a local drive, raid partition, lvm/md device, external NAS, SAN, NFS share or SMB share. The only condition is that the I/O throughput should be up to handling what Zoneminder will throw at it. For that speed reason, some favour non-journalled filesystems and accept the extra risk of data corruption

4. Locate Zoneminder’s “events” and “images” directories. In Debian and Ubuntu, these are under /var/cache/zoneminder. In CentOS and Fedora, these are under /var/lib/zoneminder.

If you wish to copy the data across, MOVE the events and images directories to /newdrive/zoneminder (Note this will take a long time on systems with many events). Also, DO NOT restart zoneminder until this entire process is completed. Doing so will cause all your events to be lost!

If you don’t wish to preserve the data, it is MUCH faster to simply delete or rename the original events and images dirs and create new directories in /newdrive/zoneminder. There is no need to remove the “orphaned” entries in the database, zmaudit will take care of those.

Eg:

mkdir /newdrive/zoneminder/events

mv /var/lib/zoneminder/events/* /var/lib/zoneminder/events_old/ — or — rm -rf /var/lib/zoneminder/events/

Add these lines in fstab to bind-mount an alternate location:

Source: ZoneMinder Wiki – Wiki – Using a dedicated Hard Drive

ZoneMinder Wiki – Wiki – Using a dedicated Hard Drive was last modified: July 13th, 2017 by Jovan Stosic