OpenMediaVault-Plugin-Developers / openmediavault-flashmemory

OpenMediaVault plugin for folder2ram
25 stars 6 forks source link

Add more directories in folder2ram.conf #32

Closed xmcp closed 3 months ago

xmcp commented 3 months ago

I used csysdig to monitor file writes on my NAS, and found that the below two locations are frequently written but not covered by this plugin:

Can we add these two locations in folder2ram.conf, or provide a mechanism for users to customize the folder2ram.conf themselves?

ryecoaaron commented 3 months ago

/var/lib/php used to be in the list but it caused too many issues. So, it was removed years ago in OMV 4.x version of the plugin. Not everyone uses fail2ban. So, I will look at a way to add extra directories.

xmcp commented 3 months ago

I think exposing a config entry in the web ui (just like the webdav plugin) seems a reasonable idea.

Also I'm curious about these "too many issues". If we only add the sessions subdirectory, will the issues go away?

ryecoaaron commented 3 months ago

We will see. The plugin doesn't currently store anything in the database. So, that would be an easy change. But, people haven't asked to add more custom directories since the beginning. If there was a field to put custom directories in from the web interface, people might add directories that fill tmpfs or cause other problems. I think I would prefer a variable in /etc/default/openmediavault

It was 4+ years ago so I don't really remember the exact issues. I would guess it had to do with the structure not being recreated causing omv-engined not to start or people not being able to login. We also aren't seeing flash media hitting write limts and failing because it is not in there. So, not much reason to add it back. I have had RPis run for 4+ years on an SD card and still not see failures.

xmcp commented 3 months ago

I'm observing >0.3op/s idling disk writes on my RPi4, mostly due to those two directories. Although this number is not scarily large, decreasing it down to zero would be nicer for me.

image

I think adding a config variable in /etc/default/openmediavault will be fine as long as users can easily find it (e.g., add a brief description in the #/services/flashmemory webpage?)

ryecoaaron commented 3 months ago

7.0.1 in the repo.

Just add a comma separated list of paths you want to add to the OMV_FM_EXTRA_DIRS variable in /etc/default/openmediavault. I added a link to the wiki in the plugin. I will update the wiki when I get a chance.

omv-env set OMV_FM_EXTRA_DIRS "/srv/test1,/srv/test2'

https://github.com/OpenMediaVault-Plugin-Developers/openmediavault-flashmemory/commit/b6fd944c53676e7690d75901552950cb13e0a8a7

xmcp commented 3 months ago

image

I have installed the 7.0.1 update and can confirm that idling disk writes are decreasing (0.3285 → 0.1981) after adding these two directories in folder2ram.conf. Thanks for the update!