Storage Issues

Forum for questions and support relating to the 1.32.x releases only.
Post Reply
edcerwin
Posts: 5
Joined: Fri May 11, 2018 12:33 pm

Storage Issues

Post by edcerwin » Thu Jun 27, 2019 4:09 am

within the last couple days my zoneminder stopped seeing my storage folder. Errors of path does not exist and cannot write to content dir make sure it exists and is owned by the web account user.

I have triple checked that all dirs are owned by www-data, i have even created another event folder on seperate drive and changed permissions accordingly and nothing works.....my storage is stuck at 0 percent and will not record anything.. Am i missing something? My storage has over 100 gigs left

kitkat
Posts: 65
Joined: Sun Jan 27, 2019 5:17 pm

Re: Storage Issues

Post by kitkat » Thu Jun 27, 2019 10:37 am

Are the folders above the storage folder accessible to the ZM user as well as the Apache user?

Using the example from another post, if the storage is at '/data/zoneminder' then the folder /data/ would need permissions of rwxr-xr-x or 755.

edcerwin
Posts: 5
Joined: Fri May 11, 2018 12:33 pm

Re: Storage Issues

Post by edcerwin » Fri Jun 28, 2019 6:39 pm

Thanks for the reply but i have been thru the permissions extensively.. i did sudo chown -R 755 /media/3tb/zoneminder and restarted zoneminder and apache...with no luck....still says 0% storage at the top and in the storage config it says 0B of 0B :(

edcerwin
Posts: 5
Joined: Fri May 11, 2018 12:33 pm

Re: Storage Issues

Post by edcerwin » Fri Jun 28, 2019 6:39 pm

If it helps im on ubuntu mate 1804

kitkat
Posts: 65
Joined: Sun Jan 27, 2019 5:17 pm

Re: Storage Issues

Post by kitkat » Fri Jun 28, 2019 8:47 pm

edcerwin wrote:
Fri Jun 28, 2019 6:39 pm
i did sudo chown -R 755 /media/3tb/zoneminder and restarted zoneminder and apache
Did you also try...

Code: Select all

sudo chmod 755 /media /media/3tb
It's the folders above zoneminder that need 755, not those under it, and I think the -R option works down from the specified folder, not up.

bbunge
Posts: 2421
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Storage Issues

Post by bbunge » Sat Jun 29, 2019 1:11 am

edcerwin wrote:
Fri Jun 28, 2019 6:39 pm
If it helps im on ubuntu mate 1804
Kindly tell us a bit about your storage. Did you change from the Zoneminder default? Is the drive a physical drive on the same PC and how is that drive mounted? Is the storage on another device (NAS?) that you have mounted to the Zoneminder machine and if so how is it mounted?

edcerwin
Posts: 5
Joined: Fri May 11, 2018 12:33 pm

Re: Storage Issues

Post by edcerwin » Sat Jun 29, 2019 4:26 am

at first the default folder that was auto configured at install went to zero percent. Same drive as os..the errors say /var/cache/zoneminder cannot write to content dir make sure they exist and are owned by the web account user

Then i tried to make a folder on my data 3 tb drive and chown and chmod it and add it to the storage path in the menu...nope 0%... that drive is mounted in the fstab like this

#/dev/sdc1 /media/ed/Tera/3 ext4 ,user 0 0
/dev/disk/by-uuid/9e7962a4-4166-4255-8eab-fe3161df99c2 /media/ed/Tera/3 auto nosuid,nodev,nofail,x-gvfs-show 0 0

bbunge
Posts: 2421
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Storage Issues

Post by bbunge » Mon Jul 01, 2019 11:29 pm

Systemd is a safer way to mount a drive with Zoneminder. This is my first venture into multiple drives with ZM 1.32.x and someone may say I did something wrong and that is OK because my system works and I'm still willing to learn in spite of being an old guy...

I set up a Ubuntu Bionic server with two hard drives and Zoneminder 1.32.3. The second drive, sdb1, was not mounted. After the basic Zoneminder install I modified the system before I added cameras as follows:

On most Linux distros, you can view the uuid of each of your drives like so:

ls -l /dev/disk/by-uuid

On my system with two hard drives, the items above are as follows:

/var/cache/zoneminder
www-data
/dev/sdb1
7ec50da2-fc67-4ade-89c7-6047710afae2

Your configuration will be different. Options to connect to a network share will be noted herein.

Log in and become root

sudo su

Stop Zoneminder

service zoneminder stop

Create the Systemd Mount Unit whicg mounts the drive To do that create a new folder. I prefer to put mount points under /mnt and give the name of the subfolder the same name as the device or share. In my case, that would be sdb1.

mkdir /mnt/sdb1

When creating mount units with systemd, the filename describing the mount point has to be named in a specific manner. Since the folder I just created is at /mnt/sdb1, one has to name the mount unit mnt-sdb1.mount. Create that file in the /etc/systemd/system folder.

nano /etc/systemd/system/mnt-sdb1.mount

Internal drive: add the following contents, changing the path and uuid to match that of your system:
----------------------------------------------------
# systemd mount unit for ZoneMinder event storage

[Unit]
Description=systemd mount unit for ZoneMinder event storage
Before=zoneminder

[Mount]
What=/dev/disk/by-uuid/7ec50da2-fc67-4ade-89c7-6047710afae2
Where=/mnt/sdb1
Type=ext4
Options=defaults,noatime,commit=120,data=writeback

[Install]
WantedBy=multi-user.target
----------------------------------------------------
Save and close the editor.

Now enable and start the unit:

systemctl enable mnt-sdb1.mount
systemctl start mnt-sdb1.mount

Make and Set Folder Permissions We've created our primary mount point, but we aren't done yet. First, let's create some folders and set the correct permissions:

mkdir -p /mnt/sdb1/zoneminder/events
chown -R www-data:www-data /mnt/sdb1/zoneminder



Leverage the Power of Systemd If you recall, I mentioned that using systemd to manage your mount points has an advantage over the previous method. With your mount points configured with systemd, you can easily prevent ZoneMinder from starting, should the mount point fail for any reason. Anyone who has ever started ZoneMinder without realizing there was a problem reading from the events folder can tell you what happens when this occurs. You lose all your events, and yes this is by design.

To prevent that from happening we need to modify our zoneminder service file. But first make a copy just in case..

cp /lib/systemd/system/zoneminder.service /lib/systemd/system/zoneminder.service.sav

nano /lib/systemd/system/zoneminder.service

Add entries to the After= and Requires=
-------------------------------------------------------------------------------
# ZoneMinder systemd unit file
# This file is intended to work with Debian distributions

[Unit]
Description=ZoneMinder CCTV recording and surveillance system
After=network.target mysql.service mnt-sdb1.mount
# Remarked out so that it will start ZM on machines that don't have mysql installed
#Requires=mysql.service
Requires=mnt-sdb1.mount

[Service]
#User=www-data
Type=forking
ExecStart=/usr/bin/zmpkg.pl start
ExecReload=/usr/bin/zmpkg.pl restart
ExecStop=/usr/bin/zmpkg.pl stop
PIDFile=/var/run/zm/zm.pid
Restart=on-abnormal

[Install]
WantedBy=multi-user.target
------------------------------------------------------------------------------
Save and close the editor.


Now issue a daemon reload to tell systemd to pick up the change:

systemctl daemon-reload

Should the mount point fail during startup, systemd will prevent the ZoneMinder service from starting with a message stating a failed dependency. Your events are saved from deletion!

Next, create another config file for Zoneminder events

nano /etc/zm/conf.d/03-events.conf

Add the contents: ZM_DIR_EVENTS=/mnt/sdb1/zoneminder/events

Save and Close

In the Zoneminder/Options/Storage create a new storage with the path of: /mnt/sdb1/zoneminder/events

Delete the default storage

Restart Zoneminder

service zoneminder start

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests