Page 1 of 1

my database is gigabytes...

Posted: Fri Jun 15, 2018 11:12 pm
by raydude
So zoneminder filled the disk and then crashed. I lost all the recordings except the saved ones and the database is still eating the whole disk.

I'm going to truncate the logs to get 12G back, but the real question is: how do I prevent this from happening? I have four very active cameras recording to an SSD (which has burned through about 30% of it's life in two years) and this has happened twice.

I would like to know how to configure zone minder to not eat the disk alive.

I thought I turned off mysql logging, btw, I'll have to change that option again...

Any help would be greatly appreciated.

Update: also, my event directory contains 307G of data, but according to the GUI, almost all recordings are gone... Is there a way to clean this up without blowing away my saved recordings?

Code: Select all

server /usr/share/zoneminder/www # du -h --max-depth=1 | sort -hr
307G    ./events
307G    .
120M    ./temp
15M     ./api
2.0M    ./skins
1.1M    ./lang
540K    ./tools
520K    ./images
280K    ./includes
224K    ./fonts
136K    ./css
68K     ./ajax
20K     ./js
16K     ./graphics
12K     ./views

Code: Select all

MariaDB [zm]> SELECT TABLE_NAME, table_rows, data_length, index_length,  round(((data_length + index_length) / 1024 / 1024),2) "Size in MB" FROM information_schema.TABLES WHERE table_schema = "zm";         
+----------------+------------+-------------+--------------+------------+
| TABLE_NAME     | table_rows | data_length | index_length | Size in MB |
+----------------+------------+-------------+--------------+------------+
| Config         |        215 |      196608 |            0 |       0.19 |
| ControlPresets |          0 |       16384 |            0 |       0.02 |
| Controls       |         19 |       16384 |            0 |       0.02 |
| Devices        |          0 |       16384 |            0 |       0.02 |
| Events         |        199 |     1064960 |      1540096 |       2.48 |
| Filters        |          1 |       16384 |            0 |       0.02 |
| Frames         |   77849389 |  3493855232 |   3437232128 |    6610.00 |
| Groups         |          0 |       16384 |            0 |       0.02 |
| Logs           |   62878423 | 11308892160 |   1315962880 |   12040.00 |
| MonitorPresets |         67 |       16384 |            0 |       0.02 |
| Monitors       |          4 |       16384 |            0 |       0.02 |
| Servers        |          0 |       16384 |            0 |       0.02 |
| States         |          1 |       16384 |        49152 |       0.06 |
| Stats          |   38715859 |  3074965504 |   1968701440 |    4810.02 |
| TriggersX10    |          0 |       16384 |            0 |       0.02 |
| Users          |          1 |       16384 |        16384 |       0.03 |
| ZonePresets    |          7 |       16384 |            0 |       0.02 |
| Zones          |          5 |       16384 |        16384 |       0.03 |
+----------------+------------+-------------+--------------+------------+
18 rows in set (0.00 sec)

Re: my database is gigabytes...

Posted: Sat Jun 16, 2018 2:16 am
by snake
You will want to tune the filter that deletes events when the HDD reaches a certain point.

See https://wiki.zoneminder.com/PurgeWhenFull

Re: my database is gigabytes...

Posted: Sat Jun 16, 2018 2:17 am
by bbunge
Your saved recordings should be safe.
Replace the SSD with a conventional drive. You can use a SSD for the OS and database, mount the conventional drive with systemd and set the purge when full to 85%. Make sure your database, mariadb recommended, has enough resources.

With an active system with purge set to 95% the system can fill up the drive before deletes happen and the system will go bonkers. I have seen your scenario before...