What's new

Prevent minidlna from rescanning after reboot

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

mich

Occasional Visitor
I have configured minidlna to store its database on a separate partition on my USB disk (loosely based on this post). I was hoping that this would stop minidlna from rebuilding the index every time the router is rebooted, but unfortunately, it did not. On every boot, minidlna simply deletes the existing database and builds a new one.

Does anyone know a way to prevent this behaviour? I mean, I know it is possible that someone connects the USB disk to a PC after swichting off the router, messes around with some files, and then reconnects it, resulting in an out-of-sync database, but since I don't want to do anything like that, I would really like to be able to tell minidlna that when it finds a database at startup, it can just use that without rescanning.

I'm using an RT-N66U with Merlin 34_2_sdk5.
 
I did some more searching, and I found this:
https://github.com/RMerl/asuswrt-merlin/issues/322

Apparrently, the only way to currently change this behavior is to compile the firmware myself. It seems minidlna 1.1.0 supports a switch that leaves the database intact at startup if it is still in sync, and rebuilds only in case of unrecorded changes. I'll just hope ASUS (or Merlin :)) are going to upgrade to a version >= 1.1.0 sooner or later.

Edit: Hmm, according to Merlin's changelog, minidlna has been at 1.1.0 since Merlin 31.

@Merlin, is there any chance we could get a config option or something to start minidlna without -R (since it should now rescan automatically)?
 
Last edited:
minidlna doesn't have the capability of updating/refreshing an existing database. The only way to ensure that an existing database is up-to-date is to recreate it.

This is a feature that was asked to the minidlna author a few years ago, but so far nothing.
 
I could live with minidlna recreating the complete database in case it's outdated, if it left the database intact when nothing has changed. So I guess it would be less of a database update/refresh and more of a consistency check. I had the impression that the 1.1.0 feature mentioned in the discussion on GITHub "Force a rescan if we detect a new or missing media_dir entry." might do just that?
 
I could live with minidlna recreating the complete database in case it's outdated, if it left the database intact when nothing has changed.

That's the problem. minidlna has no way of knowing if the database is out of date or not, that is why the default is to recreate it from scratch.
 
I see. Unfortunately, for me, rebuilding the database is often what causes inconsistencies in the first place, because if you perform file operations while minidlna is still scanning, its inode notification system does not seem to work properly.

There seems to be another workaround here that seems promising - I guess I'll try disabling minidlna in the webui and start it without -R in a script. If inconsistencies should ever arise, I can still manually trigger a rescan (or schedule one once a week in the middle of the night).

Thanks for your help, Merlin, and of course for your awesome work on the firmware!
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top