Closed cmonty14 closed 6 years ago
In Openmediavault (Debian) this script is using this configuration file
#################################################################################
#folder2ram main config file, autogenerated by openmediavault flashmemory plugin#
#################################################################################
#
#PROTIP: to make /var/lock or /tmp available as ram filesystems,
# it is preferable to set the variables RAMTMP, RAMLOCK
# in /etc/default/tmpfs.
#
#FILE SYSTEM: does nothing, will be implemented in the future. (everything goes to tmpfs for now)
#OPTIONS: does nothing, will be implemented in the future.
#
#<file system> <mount point> <options>
#tmpfs /var/cache #this folder will be activated later after testing is completed
tmpfs /var/log
tmpfs /var/tmp
tmpfs /var/lib/openmediavault/rrd
tmpfs /var/spool
tmpfs /var/lib/rrdcached/
tmpfs /var/lib/monit
tmpfs /var/lib/php #keep_folder_structure folder2ram does not have an equivalent yet
tmpfs /var/lib/netatalk/CNID
tmpfs /var/cache/samba
In this post on OpenMediavault forum I explain how you can track down additional folders that are seeing many writes (as you may have installed other applications ) https://forum.openmediavault.org/index.php/Thread/6438-Tutorial-Experimental-Third-party-Plugin-available-Reducing-OMV-s-disk-writes-al/
THX
I have found some statements saying /var/tmp should not be put to tmpfs saying any data in /var/tmp must survive a reboot.
Then I found a function delivered in Debian 8/9 that mounts /tmp to tmpfs by systemd: /usr/share/systemd/tmp.mount
This function uses mount option mode=1777,strictatime,nosuid,nodev
What do you think about this mount option to be used with folder2ram?
I have found some statements saying /var/tmp should not be put to tmpfs saying any data in /var/tmp must survive a reboot.
Yeah, that's why folder2ram exists. Folder2ram is placing folders that should survive a reboot in a tmpfs, and on shutdown (or if you do folder2ram -sync ) it does write back the contents to permanent storage. So that next time you start the PC the folder content is still there.
If your PC crashes or is shut down by pulling the plug, the contents of the folders you configured in folder2ram will be the same as the last time the PC was shut down correctly (or the same as the last time you ran folder2ram -syncall so you might want to place a chronjob to call that every few hours or whatever)
This function uses mount option mode=1777,strictatime,nosuid,nodev
Folder2ram uses the same mode as the parent folder it is placing in a tmpfs (the "mode=1777" means that the files in the folder can be read and written by anyone, most programs are for the very least restricted to be written only by some users, and system services use folders where only root can write), and uses nosuid,noexec,nodev mount options for the tmpfs.
I don't think strictatime is different from default relatime for anything, and I never had issues about that.
the noexec mount option blocks execution of programs in the folders you set up with folder2ram.
So you cannot use folder2ram on folders with executables like /bin, unless you edit the script and remove the "noexec" from the mount options. You can open (as root) the script in /sbin/folder2ram and change these options in the line 695 of the script (decent text editors will show the line number or have an option to enable this view) https://github.com/bobafetthotmail/folder2ram/blob/master/debian_package/sbin/folder2ram#L695
Is it correct that folder2ram -sync will write any mounted folder to disk, means I cannot select a specific folder to be synced?
Is it correct that folder2ram -sync will write any mounted folder to disk, means I cannot select a specific folder to be synced?
the command is folder2ram -syncall and it will sync all folders.
I never implemented the "sync just one folder" command that as the main user of this script (the OpenMediavault plugin) never needed the ability to sync only one folder as all the folders placed under folder2ram were deemed important.
But it's easy to add that if needed. Since the script iterates the same syncing routine over each line/mount point of the config file, I can easily add a command that looks like folder2ram -sync X where X is the number of the mount point you want to sync from the list in the config file.
Is this feature necessary for you? I can add it this evening.
Well, in my setup I consider to define a cronjob calling folder2ram -sync dir1 with another frequency than dir2.
Therefore I would appreciate if you could implement this feature.
ok done.
folder2ram -sync 1
will sync the first entry in the config file, and so on.
I won't add the ability to use names or paths instead of numbers as it's not easy to do, the number is good enough.
To update the script, run again the wget command as I said when installing, to overwrite the script with the new version from github.
I assume all is fine since no answer in a month.
Closing.
Hi, could you please advise which directories are recommended to be in tmpfs? I'm considering
/var/log /var/spool /var/tmp /var/cache