I'm experiencing a problem with ZoneMinder where event files are not being properly deleted from my external hard drive. When I delete events, either manually through the web console or automatically using filters, the events disappear from the ZoneMinder interface. However, the corresponding files and folders remain on the external hard drive where they are stored. This is happening despite having the 'Do Deletes' option enabled in ZoneMinder's settings. As a result, the hard drive space is not being freed up when events are deleted."
Any help or guidance would be much appreciated.
Events not deleted from external hard drive
-
- Posts: 1336
- Joined: Sat Aug 31, 2019 7:35 am
- Location: San Diego
Re: Events not deleted from external hard drive
Might need more info on your system and how the drive is mounted.
But try running zmaudit.pl to see if that works, and then if the problem reoccurs.
But try running zmaudit.pl to see if that works, and then if the problem reoccurs.
Re: Events not deleted from external hard drive
I have tested zmaudit.pl and at first this seemed to be the answer to my issue.
The script was supposed to delete files from the external hard drive that did not exist in the database. However the files were not actually deleted.
So, I deleted all events from the database and the hard drive manually to see what would happen, and I am getting the following error.
Ex:
┌──(kali㉿kali-raspberry-pi)-[~]
└─$ sudo zmaudit.pl
07/14/2024 06:03:37.235805 zmaudit[1214].INF [main:199] [Auditing All Storage Areas]
insecure cwd in find(depth) at /usr/share/perl/5.36/File/Find.pm line 276.
I looked at line 276 in the Find.pm script and found the line that will throw the error, but I am unsure what to do from here.
Any suggestions?
The script was supposed to delete files from the external hard drive that did not exist in the database. However the files were not actually deleted.
So, I deleted all events from the database and the hard drive manually to see what would happen, and I am getting the following error.
Ex:
┌──(kali㉿kali-raspberry-pi)-[~]
└─$ sudo zmaudit.pl
07/14/2024 06:03:37.235805 zmaudit[1214].INF [main:199] [Auditing All Storage Areas]
insecure cwd in find(depth) at /usr/share/perl/5.36/File/Find.pm line 276.
I looked at line 276 in the Find.pm script and found the line that will throw the error, but I am unsure what to do from here.
Any suggestions?
-
- Posts: 1336
- Joined: Sat Aug 31, 2019 7:35 am
- Location: San Diego
Re: Events not deleted from external hard drive
Again, what is your system OS and how is the drive mounted and formatted?
It sounds like a permissions problem, but that usually affects writing the files in the first place...
It sounds like a permissions problem, but that usually affects writing the files in the first place...
Re: Events not deleted from external hard drive
I am running:
kali-raspberry-pi 5.15.44-Re4son-v8l+ #1 SMP PREEMPT Debian kali-pi (2022-07-03) aarch64 GNU/Linux on a Raspberry-Pi 4.
The drive is mounted with this command:
sudo mount -w /dev/sda1 /media/kali/Seagate\ Basic
Formatted: ext4
To confirm ZoneMinder files are being created at this location without issue.
Here is a look the permissions:
┌──(kali㉿kali-raspberry-pi)-[~]
└─$ ls -l /media/kali/Seagate\ Basic
total 20
drwxr-xr-x 4 www-data www-data 4096 Jul 14 06:19 Zm
kali-raspberry-pi 5.15.44-Re4son-v8l+ #1 SMP PREEMPT Debian kali-pi (2022-07-03) aarch64 GNU/Linux on a Raspberry-Pi 4.
The drive is mounted with this command:
sudo mount -w /dev/sda1 /media/kali/Seagate\ Basic
Formatted: ext4
To confirm ZoneMinder files are being created at this location without issue.
Here is a look the permissions:
┌──(kali㉿kali-raspberry-pi)-[~]
└─$ ls -l /media/kali/Seagate\ Basic
total 20
drwxr-xr-x 4 www-data www-data 4096 Jul 14 06:19 Zm
-
- Posts: 1336
- Joined: Sat Aug 31, 2019 7:35 am
- Location: San Diego
Re: Events not deleted from external hard drive
The only thing I see different from what I'd call "normal". Suggest you auto-mount in /etc/fstabThe drive is mounted with this command:
sudo mount -w /dev/sda1 /media/kali/Seagate\ Basic
Formatted: ext4
Re: Events not deleted from external hard drive
To get around teh Cwd tainted error you can comment out line 641 of zmaudit.pl
Re: Events not deleted from external hard drive
Could it be that Zoneminder is getting its hands on the mount point, /media/kali/Seagate Basic before you've run that command? i.e. when ZM is started at boot?dougmccrary wrote: ↑Tue Jul 16, 2024 3:41 amThe only thing I see different from what I'd call "normal". Suggest you auto-mount in /etc/fstabThe drive is mounted with this command:
sudo mount -w /dev/sda1 /media/kali/Seagate\ Basic
Formatted: ext4
This could cause some confusion, as ZM may hold onto a file handle to the underlying mount point (which may have different permissions, no actual CONTENT there), whereas when you look with "ls" you see the mounted file system.
Ensure the filesystem mount is done well before ZM starts.
Re: Events not deleted from external hard drive
Success!
I added a new line to the /etc/fstab file to auto mount the drive.
zmaudit.pl is now working as expected, and is also no longer throwing any errors
I think the plan will be to run this as a cronjob once per hour.
Thanks for the help!!
I added a new line to the /etc/fstab file to auto mount the drive.
zmaudit.pl is now working as expected, and is also no longer throwing any errors
I think the plan will be to run this as a cronjob once per hour.
Thanks for the help!!