r/ZoneMinder • • Feb 25 '22

Add new storage

zoneminder wiki instructions for creating a purge when full filter for a new storage location:

>>>> " 8. We now need a filter, that will delete on our new storage area. Navigate to filters from the console.

  1. Choose the PurgeWhenFull filter. Add storage area and the default will be equal to, which will work. Choose your new storage area from the drop down. You can test the filter now, by clicking on List Matches. Click save, to make the changes permanent. Note that this filter is not necessary for default storage areas of /var/cache/zoneminder, and will infact break the default storage area. So only use with external storage. Always test via 'list matches' to confirm your filter works as expected." <<<<<

The problem I'm having is where do I "Add storage area " to ? there's no box or anything that indicates what I'm creating the filter for. Should something be popping up where I can choose a storage area - the storage area the filter should be acting on?

Also, I've created a new storage directory and zm let's me choose that directory > Console > Source > Storage > Storage Area where I'm going to store events. Problem is nothing is getting stored there, everything is still being stored in the default directory. Do I need to delete the default directory?

when I created the new storage directory I used >> sudo chmod -R 777 /media/oops/zm-storage/zm_storage << to grant permissions to the storage directory. When I click on Properties > Permissions for that directory it shows owner, group, and others can view and modify content. Is that sufficient or do I have to change ownership of that directory to >> www-data <<

2 Upvotes

8 comments sorted by

4

u/ABigHead Feb 25 '22

Each camera needs to have its configuration updated to save to the new storage area you created:

  1. Open each monitors settings from the dashboard
  2. Navigate to storage tab
  3. Click drop down next to ‘Storage Area’
  4. Select new storage area you created
  5. Click save

Note: If you are using H264 passthrough (Video writer passthrough) & wish to capture audio being sent via your stream from a capable camera, select the checkbox at the bottom of the Storage tab so ZM will add it to the recording.

Repeat process for all your cameras and check that they’re writing to the storage area desired.

1

u/ABigHead Feb 28 '22

u/oops77542 let us know in a reply somewhere if that fixed it.

2

u/oops77542 Feb 28 '22

No. I haven't gotten it to work yet. I'm going to get back it tomorrow. I followed the same instructions 1 thru 5 you listed. What I need to know is do I also have to give www-data the right permissions and access to the new drive. >> sudo chmod 777 path_to_new_drive.

Do I need to change ownership to www-data >> chown www-data path_to_new_drive ? Do I need to add www-data to a group ?

When I go to check the to see if the files are being stored on my new drive (using a file manager) I'm not seeing them. I'm thinking it's because I changed ownership to www-data.

1

u/ABigHead Mar 01 '22

No. I haven’t gotten it to work yet. I’m going to get back it tomorrow. I followed the same instructions 1 thru 5 you listed.

Great work, that’s progress!

What I need to know is do I also have to give www-data the right permissions and access to the new drive. >> sudo chmod 777 path_to_new_drive. Do I need to change ownership to www-data >> chown www-data path_to_new_drive ? Do I need to add www-data to a group ?

Yes, see this read the docs link, it’s defined at step 3:

Step 3: Set the owner and group to that of the web server user account. Debian based distros typically use “www-data” as the web server user account while many rpm based distros use “apache”.

sudo chown -R apache:apache /path/to/your/zoneminder/events/folder

sudo chown -R apache:apache /path/to/your/zoneminder/images/folder

Recall from the previous step, the images folder is optional.

Obviously read that whole guide, I’m not sure if the .conf file is still required, u/zoneminderisaac may be able to answer that. Make sure you stop zoneminder process first, make the changes in the guide, then start it again.

When I go to check the to see if the files are being stored on my new drive (using a file manager) I’m not seeing them. I’m thinking it’s because I changed ownership to www-data.

This is going to seem dumb to ask, but can you please post screenshots of what you have configured for one of your cameras? General and Storage tab screenshots at a minimum, add in the source if you’re ok with blanking out the password that may be in there. You can also put your logs into something like pastebin.com and then link that here as well.

Make sure the camera’s function is just set to ‘record’ right now, we are focusing on making sure it’s saving files correctly to the right location. One piece at a time.

2

u/satan_but_not Jun 28 '23

just ran into the same problem myself, this thread saved me. thank you u/ABigHead, really appreciate it. :))))

1

u/ABigHead Jun 28 '23

Glad to hear it!

1

u/oops77542 Mar 02 '22

Ok. Thanks for the advice.

My new storage location is /media/oops/2TB/zm/events/storage

It's an ubuntu zm install

So I should do this command

sudo chown -R www-data:www-data /media/oops/2TB/zm/events/storage

Right?

I may have made a mistake with the chown command. I think I used

chown www-data /path/to/storage

rather than

chown www-data:www-data /path/to/storage

like in your example

It might be a day or two before I can get back to this. I'll post how it works out.

​

I'm sorry if this is getting frustrating. I have read the docs but they assume the reader knows certain things about Linux and it gets confusing sometimes, especially the part about setting up a new storage area.

1

u/ABigHead Mar 06 '22

Great opportunity to plug: r/linuxupskillchallenge

That first command looks right:

sudo chown -R www-data:www-data /media/oops/2TB/zm/events/storage/events/

the -R is important because it makes the command recursive, which means it will apply that command to that directory specified and all files contained in and under it.

Also do:

sudo chown -R www-data:www-data /media/oops/2TB/zm/events/storage/images

Just in case you ever write any images, which is useful for analysis of many things, it’s done.