Data source path for USB drive not found - solved. Needed to edit FSTAB to survive PI reboot
Data source path for USB drive not found - solved. Needed to edit FSTAB to survive PI reboot
Describe Your Environment
Version of ZoneMinder - zoneminder-v1.36.33
How you installed ZoneMinder - Install on Debian Bookworm (PI5) 8GB ram, 32gb SD card, 4 cores, 19gb / 30Gb free on system drive
Full name and version of OS: Debian Bookworm
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm
The installation appears clean
Issue: Stopping events and images from filling the system drive - changing the storage default to an external 2tb drive:
/media/fairfacts/zonedata/events
Logs show: /media/fairfacts/zonedata/events and the error
web_php 44839 ERR Path /media/fairfacts/zonedata/events does not exist.
and 0.0 used of the 2 TB drive
In debian
df -h
Filesystem Size Used Avail Use% Mounted on
udev 1.9G 16K 1.9G 1% /dev
tmpfs 405M 6.0M 399M 2% /run
/dev/mmcblk0p2 29G 5.7G 22G 21% /
tmpfs 2.0G 3.3M 2.0G 1% /dev/shm
tmpfs 5.0M 48K 5.0M 1% /run/lock
/dev/mmcblk0p1 510M 67M 444M 14% /boot/firmware
tmpfs 405M 208K 405M 1% /run/user/1000
/dev/sda1 1.8T 40K 1.7T 1% /media/fairfacts/zonedata <- the 2 TB attached drive formatted as EXT4 although same error as FAT32 or NTFS
Have tried to make sure its not rights:
sudo chmod 755 /media/fairfacts/zonedata /media/fairfacts/zonedata/events
sudo systemctl reload apache2.service
sudo systemctl stop zoneminder
sudo systemctl start zoneminder
Tried FAT32, NTFS and EXT4 none work
In debian file explorer the disk shows as: /media/fairfacts/2.0 TB Volume/events
In the command window it shows as: /media/fairfacts/zonedata/events
I have tried dev/sda/sda1 and variants of the path and none seem to work
and TADA ...... restarted zoneminder and it now works. Forcing the MKDIR events as the www-data user appears to have resolved the issue - plus adding the fairfacts.conf file with the path. Now I only get a telemetry error and the full 2 TB (well 1.7 available) shows in storage .... YAY actions below:
sudo systemctl stop zoneminder
:/etc/zm/conf.d $ sudo nano fairfacts.conf
ZM_DIR_EVENTS=/media/fairfacts/zonedata/events
sudo chown www-data /media/fairfacts/zonedata
cd media
cd fairfacts
cd zonedata
sudo -u www-data mkdir events
sudo -u www-data mkdir images
sudo systemctl stop zoneminder
sudo chmod 777 /media/fairfacts/zonedata/events
sudo chmod 777 /media/fairfacts/zonedata/images
sudo chmod 777 /media/fairfacts
added to FSTab to make sure mount point remains stable
UUID=16096ad4-2392-4246-b867-112ce5d8d58b /media/fairfacts/zonedata ext4 defaults 0 2
sudo systemctl start zoneminder
I dont like the 777 on fairfacts and down so I may keep playing with tightening these up - but for now I have data storage running to an external drive !
Version of ZoneMinder - zoneminder-v1.36.33
How you installed ZoneMinder - Install on Debian Bookworm (PI5) 8GB ram, 32gb SD card, 4 cores, 19gb / 30Gb free on system drive
Full name and version of OS: Debian Bookworm
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm
The installation appears clean
Issue: Stopping events and images from filling the system drive - changing the storage default to an external 2tb drive:
/media/fairfacts/zonedata/events
Logs show: /media/fairfacts/zonedata/events and the error
web_php 44839 ERR Path /media/fairfacts/zonedata/events does not exist.
and 0.0 used of the 2 TB drive
In debian
df -h
Filesystem Size Used Avail Use% Mounted on
udev 1.9G 16K 1.9G 1% /dev
tmpfs 405M 6.0M 399M 2% /run
/dev/mmcblk0p2 29G 5.7G 22G 21% /
tmpfs 2.0G 3.3M 2.0G 1% /dev/shm
tmpfs 5.0M 48K 5.0M 1% /run/lock
/dev/mmcblk0p1 510M 67M 444M 14% /boot/firmware
tmpfs 405M 208K 405M 1% /run/user/1000
/dev/sda1 1.8T 40K 1.7T 1% /media/fairfacts/zonedata <- the 2 TB attached drive formatted as EXT4 although same error as FAT32 or NTFS
Have tried to make sure its not rights:
sudo chmod 755 /media/fairfacts/zonedata /media/fairfacts/zonedata/events
sudo systemctl reload apache2.service
sudo systemctl stop zoneminder
sudo systemctl start zoneminder
Tried FAT32, NTFS and EXT4 none work
In debian file explorer the disk shows as: /media/fairfacts/2.0 TB Volume/events
In the command window it shows as: /media/fairfacts/zonedata/events
I have tried dev/sda/sda1 and variants of the path and none seem to work
and TADA ...... restarted zoneminder and it now works. Forcing the MKDIR events as the www-data user appears to have resolved the issue - plus adding the fairfacts.conf file with the path. Now I only get a telemetry error and the full 2 TB (well 1.7 available) shows in storage .... YAY actions below:
sudo systemctl stop zoneminder
:/etc/zm/conf.d $ sudo nano fairfacts.conf
ZM_DIR_EVENTS=/media/fairfacts/zonedata/events
sudo chown www-data /media/fairfacts/zonedata
cd media
cd fairfacts
cd zonedata
sudo -u www-data mkdir events
sudo -u www-data mkdir images
sudo systemctl stop zoneminder
sudo chmod 777 /media/fairfacts/zonedata/events
sudo chmod 777 /media/fairfacts/zonedata/images
sudo chmod 777 /media/fairfacts
added to FSTab to make sure mount point remains stable
UUID=16096ad4-2392-4246-b867-112ce5d8d58b /media/fairfacts/zonedata ext4 defaults 0 2
sudo systemctl start zoneminder
I dont like the 777 on fairfacts and down so I may keep playing with tightening these up - but for now I have data storage running to an external drive !
Last edited by fairfacts on Fri Feb 14, 2025 2:48 pm, edited 7 times in total.
Re: Data source path for USB drive not found
Not entirely sure, but that line may not be correct. On a directory, 7 is read-write-enter for "the user" that owns it. From your sudo, that looks like root may own it. You then only grant READ and ENTER to "group" and "others" with 5 5 ... which means that the user that Zoneminder runs as may not be able to create the necessary directories.
So it could still be permissions. In the absence of knowing the correct answer, as a _test_ (not a good fix) try using 777 to allow wide open permissions. If it suddenly starts working, look again at which user is "owner", look at the "group" that the middle 5 applies to, an maybe leave "others" at 5 to keep any miscreants from deleting events!
If the two directories above definitely exist, then a "does not exist" message is spurious, and can probably be treated as "does exist but I can't get AT it!"
What do these show for the permissions and OWNER/GROUP column?
Code: Select all
ls -la /media/fairfacts
ls -la /media/fairfacts/zonedata
Re: Data source path for USB drive not found
Further note: The df-h/mount line looks ok. /dev/sda is "the whole disk" including the partition table, don't try and mount that, it probably won't let you. /dev/sda1 is the first partition, which is where your file system most likely actually is. So this is ok!
Re: Data source path for USB drive not found
fairfacts@raspberrypi:~ $ ls -la /media/fairfacts
total 12
drwxr-x---+ 3 root root 4096 Feb 12 21:06 .
drwxr-xr-x 3 root root 4096 Feb 12 19:44 ..
drwxr-xr-x 5 root root 4096 Feb 12 21:17 zonedata
fairfacts@raspberrypi:~ $ ls -la /media/fairfacts/zonedata
total 36
drwxr-xr-x 5 root root 4096 Feb 12 21:17 .
drwxr-x---+ 3 root root 4096 Feb 12 21:06 ..
drwxr-xr-x 2 www-data root 4096 Feb 12 21:14 events
-rw-r--r-- 1 root root 47 Feb 12 21:17 fairfacts.conf
drwxr-xr-x 2 www-data root 4096 Feb 12 21:14 images
drwx------ 2 root root 16384 Feb 12 21:02 lost+found
fairfacts@raspberrypi:~ $
Bolded the apache user rights. I think I used a different CH statement previously (I will check) because some scripts install apps as root (I generally try not to do that)
total 12
drwxr-x---+ 3 root root 4096 Feb 12 21:06 .
drwxr-xr-x 3 root root 4096 Feb 12 19:44 ..
drwxr-xr-x 5 root root 4096 Feb 12 21:17 zonedata
fairfacts@raspberrypi:~ $ ls -la /media/fairfacts/zonedata
total 36
drwxr-xr-x 5 root root 4096 Feb 12 21:17 .
drwxr-x---+ 3 root root 4096 Feb 12 21:06 ..
drwxr-xr-x 2 www-data root 4096 Feb 12 21:14 events
-rw-r--r-- 1 root root 47 Feb 12 21:17 fairfacts.conf
drwxr-xr-x 2 www-data root 4096 Feb 12 21:14 images
drwx------ 2 root root 16384 Feb 12 21:02 lost+found
fairfacts@raspberrypi:~ $
Bolded the apache user rights. I think I used a different CH statement previously (I will check) because some scripts install apps as root (I generally try not to do that)
Re: Data source path for USB drive not found
after 777 Note fairfacts is a higher level directory so I shouldnt (?) need to change that right and didnt - but I did apply to the child directories:
fairfacts@raspberrypi:~ $ ls -la /media/fairfacts
total 12
drwxr-x---+ 3 root root 4096 Feb 12 21:06 .
drwxr-xr-x 3 root root 4096 Feb 12 19:44 ..
drwxrwxrwx 5 root root 4096 Feb 12 21:17 zonedata
fairfacts@raspberrypi:~ $ sudo chmod 777 /media/fairfacts/zonedata /media/fairfacts/zonedata/events
fairfacts@raspberrypi:~ $ ls -la /media/fairfacts/zonedata
total 36
drwxrwxrwx 5 root root 4096 Feb 12 21:17 .
drwxr-x---+ 3 root root 4096 Feb 12 21:06 ..
drwxrwxrwx 2 www-data root 4096 Feb 12 21:14 events
-rw-r--r-- 1 root root 47 Feb 12 21:17 fairfacts.conf
drwxr-xr-x 2 www-data root 4096 Feb 12 21:14 images
drwx------ 2 root root 16384 Feb 12 21:02 lost+found
fairfacts@raspberrypi:~ $
But I dont see zonedata directory in this (which is really the root for events and images)
PS not resolved. I DIDNT restart zoneminder or apache because I dont think its required for this change
fairfacts@raspberrypi:~ $ ls -la /media/fairfacts
total 12
drwxr-x---+ 3 root root 4096 Feb 12 21:06 .
drwxr-xr-x 3 root root 4096 Feb 12 19:44 ..
drwxrwxrwx 5 root root 4096 Feb 12 21:17 zonedata
fairfacts@raspberrypi:~ $ sudo chmod 777 /media/fairfacts/zonedata /media/fairfacts/zonedata/events
fairfacts@raspberrypi:~ $ ls -la /media/fairfacts/zonedata
total 36
drwxrwxrwx 5 root root 4096 Feb 12 21:17 .
drwxr-x---+ 3 root root 4096 Feb 12 21:06 ..
drwxrwxrwx 2 www-data root 4096 Feb 12 21:14 events
-rw-r--r-- 1 root root 47 Feb 12 21:17 fairfacts.conf
drwxr-xr-x 2 www-data root 4096 Feb 12 21:14 images
drwx------ 2 root root 16384 Feb 12 21:02 lost+found
fairfacts@raspberrypi:~ $
But I dont see zonedata directory in this (which is really the root for events and images)
PS not resolved. I DIDNT restart zoneminder or apache because I dont think its required for this change
Re: Data source path for USB drive not found
If I drop back to fairfacts (a directory on the PI in the path to the mount point:
Default /media/fairfacts local Medium 7.23GB of 28.69GB
it works but its writing to the PI drive and shows the capacity of the PI not the USB
Anything 'deeper' doesnt work
Default /media/fairfacts local Medium 7.23GB of 28.69GB
it works but its writing to the PI drive and shows the capacity of the PI not the USB
Anything 'deeper' doesnt work
Re: Data source path for USB drive not found
What version of RPI do you have? What memory?
Looks like you are using the RPI with a desktop version of the OS. You would be better to use the version without desktop, Light version 64 bit. Install the OS on the 2 TB drive and not the SD. RPI 4 and 5 can boot from USB. WIll solve a lot of your problems .
Install Zoneminder with these instructions: https://wiki.zoneminder.com/Debian_12_B ... and_1.37.x
Also recommend a case with a PWM cooling fan.
Looks like you are using the RPI with a desktop version of the OS. You would be better to use the version without desktop, Light version 64 bit. Install the OS on the 2 TB drive and not the SD. RPI 4 and 5 can boot from USB. WIll solve a lot of your problems .
Install Zoneminder with these instructions: https://wiki.zoneminder.com/Debian_12_B ... and_1.37.x
Also recommend a case with a PWM cooling fan.
Re: Data source path for USB drive not found
I get that might be an option - but I have only 5 cameras and run pihole and will likely run homeassistant and it should be ok. I dont want to use a 'parts cannon' and solve problems I dont have - this drive access seems to have been an issue in the past and may still be an issue that likley has an answer in config.
I actually have a fan but have the POE hat on and the fan wont fit with the POE hat and it isnt running hot (the hat interferes with the fan casing)
I really have no issues with zoneminder except it wont recognize the USB drive and I have no reason to expect raspian light to solve that. I have done ALL the config on the PI for this using bash commands and its been running clean for 2 days except for the drive error which would be pretty much the same process on Raspian light because I would apply the same commands.
I have just found the file I created fairfacts.cfg wasnt where I expected it (to add the disk path). So I will move it and see if anything changes. I dont expect it to since some directories are fine but anything on the new disk isnt
I actually have a fan but have the POE hat on and the fan wont fit with the POE hat and it isnt running hot (the hat interferes with the fan casing)
I really have no issues with zoneminder except it wont recognize the USB drive and I have no reason to expect raspian light to solve that. I have done ALL the config on the PI for this using bash commands and its been running clean for 2 days except for the drive error which would be pretty much the same process on Raspian light because I would apply the same commands.
I have just found the file I created fairfacts.cfg wasnt where I expected it (to add the disk path). So I will move it and see if anything changes. I dont expect it to since some directories are fine but anything on the new disk isnt
Re: Data source path for USB drive not found
PS in my original post:
How you installed ZoneMinder - Install on Debian Bookworm (PI5) 8GB ram, 32gb SD card, 4 cores, 19gb / 30Gb free on system drive
How you installed ZoneMinder - Install on Debian Bookworm (PI5) 8GB ram, 32gb SD card, 4 cores, 19gb / 30Gb free on system drive
Re: Data source path for USB drive not found
PROGRESS...
Recreated the fairfacts.conf file in etc/zm/conf.d
contents
ZM_DIR_EVENTS=/media/fairfacts/zonedata/events
and now the log message is better !
Can't mkdir /media/fairfacts/zonedata/events/1: Permission denied
but still some
Path /media/fairfacts/zonedata does not exist.
in the logs.
Recreated the fairfacts.conf file in etc/zm/conf.d
contents
ZM_DIR_EVENTS=/media/fairfacts/zonedata/events
and now the log message is better !
Can't mkdir /media/fairfacts/zonedata/events/1: Permission denied
but still some
Path /media/fairfacts/zonedata does not exist.
in the logs.
Re: Data source path for USB drive not found
You are using the desktop system to detect the USB drive. You would be better off to use fstab to mount the drive on boot. Google is your friend to mount the drive under RPIOS aka Debian 12.
Use the mount drive part from this: https://www.raspberrypi.com/tutorials/n ... -tutorial/
Use EXT4 on the USB drive as NTFS or FAT32 will not allow symbolic links.
Running 5 cams on a RPI you should use cooling. I would put the HA on another device even though the RPI5 is a beast.
Really consider just using the light OS. Your ZM system will be happier on the RPI.
Use the mount drive part from this: https://www.raspberrypi.com/tutorials/n ... -tutorial/
Use EXT4 on the USB drive as NTFS or FAT32 will not allow symbolic links.
Running 5 cams on a RPI you should use cooling. I would put the HA on another device even though the RPI5 is a beast.
Really consider just using the light OS. Your ZM system will be happier on the RPI.
Re: Data source path for USB drive not found
Lol I DID all the mount and file (and install) operations through the terminal. I dont have any visual tools installed other that file manager which is pretty useless !
I actually prefer to SSH into the PI and use my windows machine because copy and paste works better (and I make less mistakes !)
Now I have a new problem - I have deleted all the directories below zoneminder and recreated them as www-data user and opened up permissions with CHmod
I still get the permissions error on creating the monitor sub directories but either the log message is wrong or the www-data user isnt the one using the mkdir command (because it owns zoneminder/events and zoneminder/images
What log do I look at to examine what user is trying to execute the mkdir ? (I guess it could be related to the mariadb and that has a permissions issue but I want to see a log that shows the extra detail. Maybe an apache log ?
I actually prefer to SSH into the PI and use my windows machine because copy and paste works better (and I make less mistakes !)
Now I have a new problem - I have deleted all the directories below zoneminder and recreated them as www-data user and opened up permissions with CHmod
I still get the permissions error on creating the monitor sub directories but either the log message is wrong or the www-data user isnt the one using the mkdir command (because it owns zoneminder/events and zoneminder/images
What log do I look at to examine what user is trying to execute the mkdir ? (I guess it could be related to the mariadb and that has a permissions issue but I want to see a log that shows the extra detail. Maybe an apache log ?
Re: Data source path for USB drive not found
This is really a test for a future system that will run up to 16 cameras so I will likely have to buy another PI but with bigger memory and a bigger flash card for that purpose (since I did start to see lag when testing more cameras - although I suspect that was more shortage of disk space than processor limits (its a 4 core - I havent looked at higher specs yet). If I do have to separate the PI's then I will likely use this one for homeassistant and Pihole and separate new device for zonemanager with dedicated SSD storage for performance writing to disk.
I have 24+24+16 POE ports available at home so I always prefer POE power (and the POE switches are on UPS) compared to a USB power supply.
I have 24+24+16 POE ports available at home so I always prefer POE power (and the POE switches are on UPS) compared to a USB power supply.
Re: Data source path for USB drive not found
HUH regardless of the log error
Can't mkdir /media/fairfacts/zonedata/events/1: Permission denied
zoneminder DID successfully create events/1 (and 2,3,4 - I currently have just 4 streams registered) but the directories are empty, so MKDIR succeeded but the next operation to read the directory (and subsequently write files) isnt seeing the created folders
Can't mkdir /media/fairfacts/zonedata/events/1: Permission denied
zoneminder DID successfully create events/1 (and 2,3,4 - I currently have just 4 streams registered) but the directories are empty, so MKDIR succeeded but the next operation to read the directory (and subsequently write files) isnt seeing the created folders
Re: Data source path for USB drive not found
and TADA ...... restarted zoneminder and it now works. Forcing the directory create for events as the www-data user appears to have resolved the issue - plus adding the fairfacts.conf file with the path. Now I only get a telemetry error and the full 2 TB (well 1.7 available) shows in storage .... YAY