bobafetthotmail / folder2ram

mount those folders to ram without losing access to their counterpart on disk!
GNU General Public License v3.0
110 stars 21 forks source link

Installation in Debian 9 #9

Closed cmonty14 closed 6 years ago

cmonty14 commented 6 years ago

Hi! How should I install folder2ram in a Debian 9 system? Where do I get the configuration files etc.?

THX

bobafetthotmail commented 6 years ago

I suppose the readme wasn't clear enough, I'll probably copy what I wrote here in the readme on github later.

It says: "just copy it from /debian_package/sbin into the /sbin of your system, chmod +x it to make it executable and you are ready to go"

So, run the following commands as root or with sudo:

Download the script from this github repo directly and place it in /sbin with this command wget -O /sbin/folder2ram https://raw.githubusercontent.com/bobafetthotmail/folder2ram/master/debian_package/sbin/folder2ram

Then make it executable chmod +x /sbin/folder2ram

Then execute it (still as root) to see the help. folder2ram

and you will see the following help text


Welcome to folder2ram version 0.2.7  !
folder2ram is a script-based utility that relocates the contents of a folder to RAM
and on shutdown unmounts it safely synching the data back to the permanent storage.

There are four main components of folder2ram system:
--the init script in /etc/init.d or the systemd service in /etc/folder2ram that calls this main script on boot and shutdown
--the main script in /etc/sbin/folder2ram
--the configuration file in /etc/folder2ram/folder2ram.conf
--the folders in /var/folder2ram, the bind-mounted folders
  they allow easy access to the original folder in permanent storage
  since if you mount folder A on folder B you lose access to folder B
  this trick allows access to B, allowing synching with the tmpfs at will

for first startup use -configure action, edit the mount points as you wish, then -mountall

list of actions (only one at a time):

-enableinit
::::::::::sets up an appropriate autostart/stop init script, does not start it

-enablesystemd
::::::::::sets up an appropriate autostart/stop systemd service, does not start it

-disableinit
::::::::::removes the autostart/stop init script and unmounts all mount points

-disablesystemd
::::::::::removes the autostart/stop systemd service and unmounts all mount points

-safe-disableinit
::::::::::removes the autostart/stop init script but unmounts only at shutdown (hence safely)
::::::::::it also works if folder2ram is unistalled shortly afterwards

-safe-disablesystemd
::::::::::removes the autostart/stop systemd service but unmounts only at shutdown (hence safely)
::::::::::it also works if folder2ram is unistalled shortly afterwards

-status
::::::::::print all mountpoints and their status (mounted or unmounted)

-syncall
::::::::::sync to disk the content of folder2ram's tmpfs folders

-mountall
::::::::::folder2ram will mount all folders in the config file

-umountall
::::::::::folder2ram will unmount all folders in the config file

-configure
::::::::::folder2ram will open the configuration file in a text editor

-reset
::::::::::restore default config file

-clean
::::::::::unmounts all folders then removes any autostart
::::::::::WARNING: this might break programs that are using files in the tmpfs
::::::::::if you have programs using the tmpfs please use -safe-disableinit or
::::::::::-safe-disablesystemd, and then reboot the system

As mentioned in the help, "for first startup use -configure action, edit the mount points as you wish, then -mountall"

So do a

folder2ram -configure

and it will generate the default config file and then ask you what is your favourite text editor to open it.

Edit that file to add your folders and then you can start it with a folder2ram -mountall

If you want to start it on boot, you will probably need to create and enable the systemd service or init script. Execute only ONE of the two commands, depending on what you are using.

A normal Debian 8 or 9 system is using systemd for services so you will need to write

folder2ram -enablesystemd

If your Debian is using init scripts instead (this is NOT the default Debian install), then write

folder2ram -enableinit

cmonty14 commented 6 years ago

Perfect!!! Now everything is clear and I can continue using this tool.