Delete Videos to reduce Disk Space Usage

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
Raptordin
Posts: 8
Joined: Mon Jan 24, 2022 3:22 pm

Delete Videos to reduce Disk Space Usage

Post by Raptordin »

Good Day everyone, I know surely that my issue is not new and most probably it is my mistake but here is a summary of my issue.

I have Zoneminder installed on a Ubuntu 21 VM hosted on my Hyper-V server and configured correctly and was running smoothly for several months.
My Storage Location is on my Raid10 8 TB File Server.

Recently Noticed that only 400 GBs remain and I need to clear some space so I did a filter (As I saw in several guides) to clear events prior to one month and Theoretically it worked as Now I only have Events around 30 days.

But to my surprise the space is still reserved and the video storage folder is the same size only the events in the web GUI are not there.

Any Help would be highly appreciated.
dougmccrary
Posts: 1172
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: Delete Videos to reduce Disk Space Usage

Post by dougmccrary »

The folder is a fixed size, like a disk or a bucket. Dump the bucket and get room for more.
If you just point zm to a disk it will use all of it.
You probably should make a partition on your system to dedicate to zm.
Raptordin
Posts: 8
Joined: Mon Jan 24, 2022 3:22 pm

Re: Delete Videos to reduce Disk Space Usage

Post by Raptordin »

How do I do that, it is a file share for a folder on my File server.

Can I just delete the folder?? will it be recreated again??

I highly appreciate your previous reply and would love some clarifications. Thanks.
dougmccrary
Posts: 1172
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: Delete Videos to reduce Disk Space Usage

Post by dougmccrary »

Not sure.
I think zm would make the folder you specify in "Storage". But you need to do whatever it takes in your file system to make zm "see" a limited space, so that probably means you should make the space and then point zm at that.
Good luck.
Raptordin
Posts: 8
Joined: Mon Jan 24, 2022 3:22 pm

Re: Delete Videos to reduce Disk Space Usage

Post by Raptordin »

Thanks for the advice will try to figure out how to do that.

In the meantime, I still do not know how to clear that space. Could I just delete the folders?? Will they be recreated autoMagically??

Is there a specific setting / Filter I can set in which it can clear the videos and clear the space ??

Thanks to all who can advise me.
Raptordin
Posts: 8
Joined: Mon Jan 24, 2022 3:22 pm

Re: Delete Videos to reduce Disk Space Usage

Post by Raptordin »

For whatever reason, I think I need to clarify.

I Made a filter to check all events older than 30 days and delete them. I did just that it deleted all events older than 30 days but did not clear the space thus the folder still holds 400 GBs of videos that are not linked to any event thus I do not know how to clear them manually unless I delete the whole folder (With all events old and recent.
If I did that will it recreate the folders again??
dougmccrary
Posts: 1172
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: Delete Videos to reduce Disk Space Usage

Post by dougmccrary »

run zmaudit.pl
It'll probably take awhile...or you could just checkmark RUN_AUDIT in Options->System toward the bottom of the page.
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: Delete Videos to reduce Disk Space Usage

Post by Magic919 »

You could blow the whole lot away, but a find/mtime/exec rm command would be nicer.

Code: Select all

sudo find /your/zoneminder_location/  -type f -mtime +7 -execdir ls -la -- '{}' \;
This will run an 'ls', for safety. Just run again with rm when happy with what it is about to remove.
-
Raptordin
Posts: 8
Joined: Mon Jan 24, 2022 3:22 pm

Re: Delete Videos to reduce Disk Space Usage

Post by Raptordin »

dougmccrary wrote: Mon Jan 24, 2022 11:13 pm run zmaudit.pl
It'll probably take awhile...or you could just checkmark RUN_AUDIT in Options->System toward the bottom of the page.
Trying this right now and it is taking ages but looks like is working. will report back when it is done.

I did use the command line since doing it from the web GUI did not do anything.

Thanks.
Raptordin
Posts: 8
Joined: Mon Jan 24, 2022 3:22 pm

Re: Delete Videos to reduce Disk Space Usage

Post by Raptordin »

Magic919 wrote: Tue Jan 25, 2022 8:17 am You could blow the whole lot away, but a find/mtime/exec rm command would be nicer.

Code: Select all

sudo find /your/zoneminder_location/  -type f -mtime +7 -execdir ls -la -- '{}' \;
This will run an 'ls', for safety. Just run again with rm when happy with what it is about to remove.
Thanks for your reply.

I do not understand what Is needed to do and what will the outcome be.

Thanks again for your reply and if you clarified I would highly appreciate it.
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: Delete Videos to reduce Disk Space Usage

Post by Magic919 »

Probably best to leave it.
-
Raptordin
Posts: 8
Joined: Mon Jan 24, 2022 3:22 pm

Re: Delete Videos to reduce Disk Space Usage

Post by Raptordin »

dougmccrary wrote: Mon Jan 24, 2022 11:13 pm run zmaudit.pl
It'll probably take awhile...or you could just checkmark RUN_AUDIT in Options->System toward the bottom of the page.
I have been running the command "zmaudit.pl" for several days now and although from the looks of it it is finding and deleting unlinked files and seems a huge TON still I see no reduction in utilized space, in fact, I am noticing a continuous increase of utilized space.

I will wait a bit more maybe if it is finished I will find a nice surprise.
dougmccrary
Posts: 1172
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: Delete Videos to reduce Disk Space Usage

Post by dougmccrary »

Yeah, it is kinda slow, but there's a lot of stuff to do, especially in your case.
I need to clarify something that I said earlier that no doubt explains that the usage you're looking at keeps increasing...
Screenshot from 2022-01-27 01-27-33.png
Screenshot from 2022-01-27 01-27-33.png (57.43 KiB) Viewed 11087 times
See where it says DiskSpace? ZM considers it owns all of that. It never really frees space, just overwrites it when it's not using it. The first number is what zm is not using at the moment.
You need to somehow create some limited space on your filesystem, as zm will use all of it. Normally, that would be a disk partition, sorry I don't know how that is done on your system.
Raptordin
Posts: 8
Joined: Mon Jan 24, 2022 3:22 pm

Re: Delete Videos to reduce Disk Space Usage

Post by Raptordin »

Just as a follow up I ended up deleting the Camera Folders while ZoneMinder VM Was Turned Off and ZoneMinder recreated them again.
Setup my Filters to auto-delete anything older than 35 days. (End Date Less than or equal -35 day

Lots hope that this works and will report later if it worked or not.
dougmccrary
Posts: 1172
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: Delete Videos to reduce Disk Space Usage

Post by dougmccrary »

See ya in a month or so.
I hope that works for you. 8)
Post Reply