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. "/etc/init.d/zoneminder stop" or "/usr/bin/zmpkg.pl stop"
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 protection
4. Locate Zoneminder's "events" and "images" directories. In Debian, these are usually in /usr/share/zoneminder
If you wish to copy the data across, MOVE the events and images directories to /newdrive (Note this will take a long time on systems with many events). Also, DO NOT restart zoneminder if it cannot locate these files as zmaudit.pl will delete the database entries for any events it cannot match files to
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 and link to them from the original locations. There is no need to remove the "orphaned" entries in the database, zmaudit will take care of those.
mv /usr/share/zoneminder/events /usr/share/zoneminder/events_old
Note: It was recommended to use ln -s /newdrive/events /usr/share/zoneminder/events to link the new partition in. However, at least with the debian and ubuntu packages, upgrading zoneminder later will delete these symlinks and create new dirs. This will result in all your existing events being removed from the database.
It has been suggested this is used instead to mount the new drives;
these lines in fstab could allow you to bind-mount an alternate location:
/dev/sdX1 /otherdrive ext3 defaults 0 2 /otherdrive/zoneminder/images /var/cache/zoneminder/images none defaults,bind 0 2 /otherdrive/zoneminder/events /var/cache/zoneminder/events none defaults,bind 0 2
or in some cases,
/otherdrive/zoneminder/images /usr/share/zoneminder/images none defaults,bind 0 2 /otherdrive/zoneminder/events /usr/share/zoneminder/events none defaults,bind 0 2
or if you have a separate partition for each:
/dev/sdX1 /var/cache/zoneminder/images ext3 defaults 0 2 /dev/sdX2 /var/cache/zoneminder/events ext3 defaults 0 2
(Repeat for images) 5. Finally, restart zoneminder ( "/etc/init.d/zoneminder start" or "/usr/bin/zmpkg.pl start") Monitor its operation and ensure new events are being created normally and are viewable. Zoneminder should also update the "Disk: %%" on its Console screen to reflect the disk space on its new partition.