Storage disk replacement - database considerations

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
cookiemonster
Posts: 67
Joined: Sat Aug 15, 2015 1:46 pm

Storage disk replacement - database considerations

Post by cookiemonster »

Hi.
I had to give up trying to setup motion detection a long time ago. I've been mocord since. I have two cameras mocording on a smallish 2 TB GB drive that gives me only 5 days for the events.
I am awaiting delivery of a new drive. I am OK with losing all events when I replace the disk.
The question is about the zm database and the audit process. I want to avoid both leaving the database in an inconsistent state that forces the audit to spike for a long time until the inconsistencies have been dealt with.

Recreate the database objects? Seems too heavy-handed. I know I can "delete * from events;" but I don't know the db structure so there might be some foreign key constraints on other tables that need taking care of.

So what do people do? What is the recommended approach?
Edit: corrected disk size.
Last edited by cookiemonster on Sun Jun 08, 2025 8:00 pm, edited 1 time in total.
User avatar
Andyrh
Posts: 303
Joined: Sat Oct 28, 2017 3:55 am

Re: Storage disk replacement - database considerations

Post by Andyrh »

Can you add a disk? If so just point new events at the new disk and wait five days or move the events.
5 days of events should not cause audit to run a long time. How many events is 5 days? In my case 7 days is ~20k events and I have lost all 60 days to a bad RAID controller. Audit cleaned it up in a few hours and did not cause new events to be lost.

I have found ZM to be robust in surviving HDD problems.
Andy
o||||o

Ubuntu 22.04
ZM 1.36.33
E5-1650-v4 Xeon
16 GB RAM
6 cameras -> 54 FPS modect
cookiemonster
Posts: 67
Joined: Sat Aug 15, 2015 1:46 pm

Re: Storage disk replacement - database considerations

Post by cookiemonster »

thank you for the input. I have just shy of 1600 events in total. Each is about 1.2 GB in size.
I haven't looked yet if I can add the disk but it's possible that I can't and have to replace. Number of SATA ports depending.
However what I want to avoid is the cpu spike. No need to burn electricity if it can be avoided, and it occurs to me that it can. But sure it will only be a few hours I expect but maybe about 2-4.
cookiemonster
Posts: 67
Joined: Sat Aug 15, 2015 1:46 pm

Re: Storage disk replacement - database considerations

Post by cookiemonster »

The new disk has arrived and the long SMART test will finish tomorrow, when I hope to install it for Zoneminder.
Any other thoughts anyone? Just yank old, put new one in and let audit repair the database? Anything better?
bbunge
Posts: 2977
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Storage disk replacement - database considerations

Post by bbunge »

Would be best to add the new drive to the computer then set up ZM to use it leaving the old drive in place. Set a filter to delete the events on the old drive, 100 at a time and when the old drive is empty remove it from ZM, remove the mount from Linux and take the drive out of the computer.
Post Reply