Disk Space Usage Higher Than Reported in ZoneMinder

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
sedat.ari
Posts: 8
Joined: Sat Feb 22, 2025 3:58 am

Disk Space Usage Higher Than Reported in ZoneMinder

Post by sedat.ari »

Hello,

I’m encountering an issue with my ZoneMinder setup where the disk usage for events appears to be higher than what’s reported in the web interface. The events are stored on a separate disk, but ZoneMinder shows less space usage compared to the actual usage on the disk (which is 10TB in total).

Here’s the situation:

I’ve noticed that the disk usage shown in ZoneMinder’s web interface is lower than what the disk is actually using.
I’m concerned that deleted images, events, or other files might still be taking up space, or that there’s an issue with how ZoneMinder handles disk space.

I’d appreciate any insights on how to better manage disk space and troubleshoot this issue.

Thanks in advance for your help!
screen2.png
screen2.png (10.24 KiB) Viewed 7990 times
screen1.png
screen1.png (31.4 KiB) Viewed 7990 times
dougmccrary
Posts: 1370
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: Disk Space Usage Higher Than Reported in ZoneMinder

Post by dougmccrary »

Probably system-reserved space. Default is 5%.
See tune2fs command.
sedat.ari
Posts: 8
Joined: Sat Feb 22, 2025 3:58 am

Re: Disk Space Usage Higher Than Reported in ZoneMinder

Post by sedat.ari »

dougmccrary wrote: Sat Feb 22, 2025 9:13 pm Probably system-reserved space. Default is 5%.
See tune2fs command.
Currently, the total size of all events displayed in the ZoneMinder web interface is 5.05TB (even less than what I originally shared in my screenshot). However, the disk I allocated for ZoneMinder is 10TB in total.

Even if the system reserves 5% of the space, that would account for around 512GB, but my disk usage is currently showing 8.9TB full. This still doesn’t explain the large discrepancy between the reported event size and the actual disk usage.

Zoneminder web gui says something else :(
dougmccrary
Posts: 1370
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: Disk Space Usage Higher Than Reported in ZoneMinder

Post by dougmccrary »

Currently, the total size of all events displayed in the ZoneMinder web interface is 5.05TB (even less than what I originally shared in my screenshot). However, the disk I allocated for ZoneMinder is 10TB in total.
What do your filters look like?
but my disk usage is currently showing 8.9TB full.
According to what?

There's a bit of overhead in the filesystem directories - how much depends on how you formatted and what storage scheme you're on.
sedat.ari
Posts: 8
Joined: Sat Feb 22, 2025 3:58 am

Re: Disk Space Usage Higher Than Reported in ZoneMinder

Post by sedat.ari »

I'm not exactly sure where or how I should be looking, as I am not an expert in system administration.

The only data I have is as follows:

There are no other files in the /storage directory except for ZoneMinder camera recordings.
The total size of the /storage directory is 8.9TB.
However, when I check ZoneMinder's web interface, the total size of all camera footage I can see is 5TB.
Recordings older than 3 months are deleted, and normally, I would keep recordings for up to 6 months.
Additionally, I had manually deleted footage from a few cameras via the web interface earlier. It was around 3-4TB in size. I’m wondering if it might not have been fully deleted from the disk. However, when I checked the size of the directories for the cameras whose footage I deleted in the /storage directory, they show as 4.0K, meaning there’s no footage left.
zm-filter.png
zm-filter.png (55.39 KiB) Viewed 7820 times
screen3.png
screen3.png (22.94 KiB) Viewed 7820 times
screen4.png
screen4.png (26.23 KiB) Viewed 7820 times
sedat.ari
Posts: 8
Joined: Sat Feb 22, 2025 3:58 am

Re: Disk Space Usage Higher Than Reported in ZoneMinder

Post by sedat.ari »

Reserved.png
Reserved.png (5.12 KiB) Viewed 7820 times
zm-filter2.png
zm-filter2.png (49.7 KiB) Viewed 7820 times
User avatar
Andyrh
Posts: 300
Joined: Sat Oct 28, 2017 3:55 am

Re: Disk Space Usage Higher Than Reported in ZoneMinder

Post by Andyrh »

To me it sounds like you have orphaned files somewhere. Scan the drive for files older than 3 months (the point you state video is being deleted) and see what shows up.
The other possibility, though unlikely, is you are using a very large block size and the missing space is slack in the blocks.
Andy
o||||o

Ubuntu 22.04
ZM 1.36.33
E5-1650-v4 Xeon
16 GB RAM
6 cameras -> 54 FPS modect
sedat.ari
Posts: 8
Joined: Sat Feb 22, 2025 3:58 am

Re: Disk Space Usage Higher Than Reported in ZoneMinder

Post by sedat.ari »

I found it!

I listed the files inside my /storage directory and noticed an ID that does not match any of my existing cameras. When I checked its size specifically, I found that it was taking up 4TB of space. After downloading and inspecting the contents (JPEG files), I realized that the camera footage belonged to a test camera, which I believe one of my colleagues set up but forgot to remove.

However, I cannot see this camera in the ZoneMinder web interface, and there is only one user account. How can I delete this camera and its recordings? Should I remove it from the database directly?
Attachments
test-camera.png
test-camera.png (45.03 KiB) Viewed 7794 times
sedat.ari
Posts: 8
Joined: Sat Feb 22, 2025 3:58 am

Re: Disk Space Usage Higher Than Reported in ZoneMinder

Post by sedat.ari »

Issue Report: Orphaned Camera in ZoneMinder

Description: I encountered an issue where ZoneMinder was still recording video from a camera that wasn't listed in the web interface or database. Despite the camera not being visible in ZoneMinder, I found its files in the /storage/65 directory, which were consuming about 3.8TB of disk space.

Investigation:

I checked the ZoneMinder database and found no record of the camera with ID 65 (SELECT * FROM Monitors WHERE Id=65; returned an empty set).
I found the camera's recording process still running using the command: ps aux | grep 'zmc -m 65', which indicated that it was actively recording.
After identifying the process, I stopped it to prevent further recording.
Conclusion: The camera was orphaned, meaning it existed as a recording source but had no corresponding entry in the ZoneMinder database. The recording process continued, but since it wasn’t listed in the database, it was effectively a "ghost" camera.
dougmccrary
Posts: 1370
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: Disk Space Usage Higher Than Reported in ZoneMinder

Post by dougmccrary »

I stopped it to prevent further recording.
Did that kill it permanently, after a restart/reboot?
You could run sudo zmaudit.pl
to check the entire disk for orphans, in case there are more somewhere.
sedat.ari
Posts: 8
Joined: Sat Feb 22, 2025 3:58 am

Re: Disk Space Usage Higher Than Reported in ZoneMinder

Post by sedat.ari »

dougmccrary wrote: Tue Feb 25, 2025 1:25 am
I stopped it to prevent further recording.
Did that kill it permanently, after a restart/reboot?
You could run sudo zmaudit.pl
to check the entire disk for orphans, in case there are more somewhere.
I haven't tried restarting the system yet because this device is in a datacenter, and I avoid rebooting it unless it's absolutely necessary. However, I plan to migrate ZoneMinder to a more powerful server soon due to my need for object detection and additional storage space.

For now, I have concerns about running the zmaudit.pl command because if it deletes recordings that I actually need, I could face legal issues. Instead, I have manually and carefully inspected my /storage directory. Other than the orphaned camera I identified, there are no additional orphaned recordings.
sedat.ari
Posts: 8
Joined: Sat Feb 22, 2025 3:58 am

Re: Disk Space Usage Higher Than Reported in ZoneMinder

Post by sedat.ari »

Object detection seems very complex to me, and I think I'll need to ask for help with that separately. :)
Post Reply