› Forums › Network Management › ZeroShell › Dramatically improve HAVP performance and save CF lifetime › Re: Improving the improvement :)
Hi Folks, I’ve just learned more about tmpfs…. 🙂
…and this simply made my original guide (the first post in this topic) obsolete.
I’ll describe here a newer and better (yet simpler) approach using tmpfs.
Using tmpfs solves the permanent memory allocation downside of the initial approach and makes the virus scanning even quicker.
The new guide:
Step 0 – Disable your HAVP proxy using the GUI, in the case it is currently enabled.
Step 1 – Undo the original approach (This step is only needed IF you have implemented the first approach described in the first post of this topic, otherwise skip it and jump right to step 2):
- > cd /Database
> rm HAVP.ext2
> umount /Database/var/register/system/havp/tmp
[ edit the pre-boot script and remove the lines you added there as part of the original guide ]
NOTE1: Unfortunately, unless if you manage to get a copy of the “busybox” tool (which BTW is not that difficult to obtain), there is not an easy way to free up the space allocated by the ram disk mount used by the original approach, so, you will have to reboot your zeroshell box to free this memory. Fortunately the new approach will never suffer from the same problem.
NOTE2: If you did manage to copy busybox to your Zeroshell instalation, instead of rebooting, just execute “busybox freeramdisk /dev/ram3”
Step 2 – The following command have to be both executed in the Zeroshell’s shell AND added to your pre-boot scripts (through the Zeroshell’s GUI):
- > mount -omand,noatime,uid=havp,gid=havp,size=50m -ttmpfs none /Database/var/register/system/havp/tmp
Step 3 – Re-enable your HAVP proxy using the GUI.
Why is tmpfs better?
tmpfs is a memory filesysytem derived from ramfs that resides in the vfs layer and which framework is the same used by the kernel for caching all files of all mounted file systems. So, tmpfs reduces the overhead of having a format like ext2, ext3, etc, needed by the /dev/ramX devices. In addition, comparing to the original approach, it reduces cpu utilization and memory accesses for every file access when compared to /dev/ramX devices.
Tmpfs eliminates the permanently allocated memory downside of using the traditional ram disks. The “size=50m” option just specifies the maximum limit size of the filesystem, not a permanent allocation. Tmpfs allocates memory on demand and only the necessary amount to hold the existing files. Every time a file is deleted or truncated, memory is freed.
For more information on tmpfs refer to the documentation found on the kernel sources tree (note: this is not installed in your Zeroshell box):