Tmpfs

Introduction
tmpfs (temporary file system) is a virtual filesystem to store files in memory.

In GNU/Linux ramfs (random access memory file system) has been replaced by tmpfs as the old ramfs did not handle well when the system run out of memory. tmpfs allows the filesystem to grow dynamically when it needs more space until it hits the pre-set maximum value it has been allocated; after that it will use swap space if it is available.

There are many ways and many things we can use the temporary file system in GNU/Linux, one being the directory which does not need to physically store non-volatile data. It doesn't matter that this data is wiped out after a reboot as you are booting up a new session which will be creating and writing new cache data and so on into the directory.

Installation
You need to activate the following kernel options:

Usage
Generation and mounting of tmpfs in one step:

You can specify the mount option size to control the maximum size of the filesystem (default: half of your memory). Note that tmpfs doesn't reserve this memory, but allocates only the needed memory.

systemd
When using systemd the directory is mounted by default as tmpfs and given a default size which is deemed big enough for your usage but not so big it will chew up too much RAM.

You can view mounted temporary filesystems using the following command:

This will show you if the mount-point is a tmpfs filesystem and will show you the set size of said filesystem.

If you want to disable this and take back control of the directory and have it controlled through your then we can do this by disabling the automatic mount from systemd and adding it to our.

This command will now not mount as a tmpfs and will automatically default back to your block device i.e. your HDD/SSD. We can now add a new line in our which will create a tmpfs for  manually.

OpenRC
OpenRC is the same as for systemd only we omit having to disable systemd from mounting the directory manually. This means it is as simple as adding the mount point into your.

Other directories to consider
Here are a few other directories the user may mount as a tmpfs in order to boost the system performance. Use the command to check if they are already use tmpfs before you attempt to manually mount them in.

Conclusion
The outcome of using a temporary filesystem for non volatile files such as the directory is that the system has a very fast and very responsive access to caching files and stored session media. This also helps when you use a browser to surf the web as cookies can be stored on this volatile media speeding up the browser and on every reboot they are scrubbed or wiped from RAM. If you intend on keeping your temporary files for analytics then use of the tmpfs for and other directories which are used similarly may not be for you. Remember all data stored in the tmpfs mount point will be lost when the system is rebooted or powered down.

Advancements in Technology
There has been some new offerings from the tech giants including a not as fast as RAM but faster than SSD technology to be used as cache drives. These devices are usually incorporated on a PCIe add-in card and have either a adaptor from PCIe to M.2 slot or the entire memory device is embedded into the PCIe card.

So if you need a non-volatile high speed versatile solution that is faster than SSD/SAS/SATA then these high speed solutions are something you should look into. Of course you would not be mounting these devices with tmpfs but instead using a conventional partitioning filesystem and then mounting the appropriate mount-point to the device such as /dev/sd* /tmp and so on.

Technology such as the Intel 3Dx Optaine memory cache can be used for task like this but this technology although more versatile than SSD it is still subject to wearing out. It does however provide a brilliant midway point that will only get better as the technology progresses in the future and provide us with a much faster much snappier computing experience when setup correctly.