Please note, ryecoaaron made a plugin to automate this procedure, see this post for details [Tutorial][Experimental]Reducing OMV's disk writes, also to install it on USB flash
----------------------back to original first post--------------------
I'm a bit puzzled that it's none's priority to tame a bit OMV to allow the use of USB flash drives for OS drive like they do for FreeNas. Or even to let hard drives rest a bit.
Shedding some light on the matter myself then.
WARNING: This system is experimental, that is, it has not been throughly tested on multiple stations to ensure everything works fine in all situations.
I CANNOT GUARANTEE DATA SAFETY. DO BACKUPS OR DO NOT TRY IT.
Volunteers that test this system are welcome.
Let's track down what files got written often, with a script I took from here http://info4admins.com/tips-to…disk-in-debian-or-ubuntu/
Place this in a /bin folder you create in your /home folder, then chmod a+x the script to make it executable.
Then you can call it by writing its name and the number of minutes you want.
ScriptName 5 will give you an output listing files written in the last 5 minutes
this is a real-life example:
The bulk of that output you see is mostly performance logging to allow OMV to make pretty graphs, and pre-made images of graphs for a page in the webGUI. And it is done pretty often, waay too often.
So, now we have a general idea of what is going on in the disk and we can start our countermeasures.
The standard practice is to disable the logging from the application's settings/config file, or to move the whole offending folder to RAM. It means any write in that folder will go in RAM instead than on disk in a completely magical way, but this also means that if the NAS reboots or crashes you will lose all modifications you made to those folders.
Since on average it's logging or temporary files, it's no big loss.
If you want to save logs or some folder contents from the tmpfs you made above have a look at this script from Solo0815 [Tutorial][Experimental]Reducing OMV's disk writes, also to install it on USB flash
Open /etc/fstab with a text editor
if yu are already root don't write sudo.
this is an example fstab
Add the noatime option to the root partition, delete any "realtime" option. This turns off the logging of the last access time of a file (that causes writes every time a file is read)
As you see in the example fstab I added only /tmp folder as a tmpfs (ram disk).
Adding other folders tends to cause problems, sadly. For example, adding /var/cache and /var/log would result in annoyances from apt and nginx and probably something else that will fail horribly or crash if they don't find their things and log files.
We need a script that mounts the appropriate folders as tmpfs and fills them with data and directory structure from a backup, then at shutdown takes the data from the tmpfs and makes a backup on disk (or not, it really matters only when booting).
Like explained here https://www.debian-administrat…/661/A_transient_/var/log
Thankfully, there is a premade package of scripts called fs2ram that does that automagically for a list of folders in its config. Not available on Wheezy, but available in Sid, here you find the .deb, install manually. https://packages.debian.org/sid/admin/fs2ram
from terminal it's this (if the package is updated in the repos and the link breaks, use the link above to find the correct download link to use):
(if you are already root don't write sudo)
Once installed it will ask you if you prefer to save logs at shutdown or just to rebuild folder structure on boot in the tmpfs. Choose the one you prefer.
Time to work on folder /var/lib/openmediavault/rrd and the /var/spool
All this stuff goes directly in fs2ram's own config file, that looks suspiciously like fstab.
to open it and the follwoing is an example:
Spot the differences between this list and the standard list in your config file.
You could theoretically add also tmpfs /var/cache keep_file_content - tmpfs, but I find it unnecessary.
I commented it out because I have only 512 MB of ram in my NAS, and /var/cache contains the apt-get package cache (and little else).
If you want to keep it in a tmpfs make sure you are running apt-get autoclean in a cronjob, or you are keeping the package cache size in check somehow.
Old tutorials usually talk about symlinking the mtab with /proc/mounts, but this was already done upstream in Debian, so we don't need to do anything about it.
Done. Reboot the system for changes to take effect, and if it does boot up again and is still operational, pat yourself on the shoulder, Good Job!
Look in logs to see if f2ram is reporting errors about some folder, and if there is any program complaining that it cannot start because it needs something.
Some programs/services will complain saying they did not find file X, check if the file has been created or not, those error reports are usually just a warning.
If I missed something or you have a file that I don't have (quite possible, as I'm running OMV on a Zyxel nsa325v2, ARM debian) please post below and I'll try to keep the OP updated.