I have external USB HDD (ext4 FS on a rotating disk) attached to my OpenWrt 21.02.2 device.
When minidlnad loads it does not see the mount points.
Fri Jun 3 11:45:02 2022 daemon.info minidlnad[1885]: [2022/06/03 11:45:02] minidlna.c:671: error: Media directory "A,/mnt/sda3/audio" not accessible [No such file or directory]
Fri Jun 3 11:45:02 2022 daemon.info minidlnad[1885]: [2022/06/03 11:45:02] minidlna.c:671: error: Media directory "V,/mnt/sda3/videos" not accessible [No such file or directory]
Fri Jun 3 11:45:02 2022 daemon.info minidlnad[1885]: [2022/06/03 11:45:02] minidlna.c:671: error: Media directory "P,/mnt/sda3/photos" not accessible [No such file or directory]
Fri Jun 3 11:45:03 2022 kern.info kernel: [ 21.572858] sda: sda1 sda2 sda3 sda4
Fri Jun 3 11:45:03 2022 kern.notice kernel: [ 21.582665] sd 0:0:0:0: [sda] Attached SCSI disk
Fri Jun 3 11:45:04 2022 daemon.info samba4-server: io_uring module found, enabling VFS io_uring. (also needs Kernel 5.4+ Support)
Fri Jun 3 11:45:04 2022 daemon.info samba4-server: io_uring module found, enabling VFS io_uring. (also needs Kernel 5.4+ Support)
Fri Jun 3 11:45:05 2022 kern.info kernel: [ 22.807455] EXT4-fs (sda3): recovery complete
Fri Jun 3 11:45:05 2022 kern.info kernel: [ 22.835553] EXT4-fs (sda3): mounted filesystem with ordered data mode. Opts:
Fri Jun 3 11:45:05 2022 kern.info kernel: [ 23.010312] Adding 1552380k swap on /dev/sda4. Priority:-2 extents:1 across:1552
I see in the system logs that minidlna fails, then hdd is recognized and mounted. I do have check fs on boot option enabled. If I reload minidlna it is able to see and serve the files. How do I delay the minidlna daemon being loaded after hdd is mounted. I have manually checked the HDD with e2fsck. There are no errors. BTW Samba4 does not seem to have this issue and has been working fine.
I did use this and service does start but it is still starting before the drive is mounted. So it cannot see any files. Once booted, I restart the service on a command line, and it can serve the files. Although I do not like systemd, but, is there something analogous that can use "requires" drive mounted? Can a shell script ...say... "loop until drive mounted" then start minidlna? Can I put it in rc.local? I am surprised nobody has seen this issue. And, Samba4 does not have any problems, it does load after the drive is mounted.
I not going to solve this trying problem, but is there any chance you have a SSD drive you could test with media on it to see if ruling out a "rotating disk" delay issue might be pointed out as the culprit?
Yes, I used to have this problem and would remove the mount point from Luci>System>Mount Points and then place the mount command in rc.local followed by the short sleep and /etc/init.d/minidlna start command that @frollic mentioned (keeping minidlna disabled in startup).