jiml8 wrote:People put /tmp in RAM because RAM is a lot faster, and they think their system will run faster if /tmp is not written to disk. Also, as a security issue, /tmp in RAM is more secure; the contents do not survive a power off or reboot. Usually, in day to day use, /tmp does not get that big. Mine presently is 11 Meg.
However, RAM is a relatively scarce and expensive resource, while hard drive space (and even SSD space) is much cheaper and far more plentiful. Given disk caching, the I/O times for /tmp are seldom an issue. Placing /tmp on an encrypted partition makes it fully secure.
And sometimes, depending on what you are doing, you will find /tmp getting filled up, to the point where your RAM-based /tmp won't be big enough no matter how much RAM you have. In my case, I got bitten while doing a large video transcode; some of the files were being cached in /tmp and I did not realize the problem.
In my not at all humble opinion, the advantages of /tmp in RAM are vastly outweighed by the potential disadvantages; I would recommend against doing it. You may have enough RAM, but you never have too much RAM...and placing /tmp in RAM wastes it.
Similarly, you will find many people on the web recommending that you disable swap (as a "performance enhancement") on a big-memory Linux system (say...above 8 GB) but it has been my experience that Linux wants that swap, regardless of how much RAM you have. Disabling swap will result in an intermittently unstable system, with symptoms you will have the devil's own time sorting out. As I say, my 32GB system has 35GB of swap, and presently 5GB is in use.
There is nothing at all wrong with experimenting, and tweaking, and trying different things. I have done that for many years myself, and I do things today the way I do them based upon what I have learned over time from all that tweaking. And figuring out that I really needed to greatly increase the swap available for my system took me a looonggg time...particularly in the face of all the googling I did that told me that a big-memory system doesn't need swap.
The moral of the story is: try things. Listen to what others say also, but use your common sense, and pay attention to your own experiences. In the current situation, you have been bitten by an out of resources condition due to /tmp in RAM. Why would you think that merely doubling RAM would prevent you from having the problem again?
For myself, /tmp is a directory on a 4 TB partition on a decently fast hard drive. I symlink to it from the root of the file system. It works fine that way, and I have to fill that entire drive to run out of /tmp.
I agreed with you: having the expensive RAM bitten by the /tmp is a thing to consider, however as you said there are security problems when you point this folder in hard disk... So we have a dilemma: I one hand, a safer system and the other hand a system with a better performance.
As I understood, you just created a symbolic link in /tmp to the Hard Disk, right? But what if I create a partition in Hard disk to /tmp, I would solve this dilemma? (Having a better performance with a more safe system)
gohlip wrote:Just adding my 2 cents here.
By normal operations, when we reboot, /tmpfs is cleared out.
After reboot, check again with "df -h", if it is so.
If not, check if your /etc/fstab has any entry for this /tmpfs. Comment out and try again (reboot).
Yeah, even not rebooting I saw the /tmpfs clearing the content. But the problem I was facing with a 4GB RAM system was having only 1,8GB of space to install a update over this size... Even I rebooting the system, I ended up having only 1,8GB: not enough in that case...
