Disable whatever is cleaning /tmp

Heinz Diehl htd at fritha.org
Sat Apr 26 07:43:41 UTC 2014


On 26.04.2014, Garry T. Williams wrote: 

> That's not true.  Swap will come into play and unreferenced data in
> the /tmp files will be paged out in favor of claiming that memory for
> other uses.

Did you actually try?

 [htd at kiera ~]$ dd if=/dev/zero of=/tmp/bigfile bs=1M count=3000
 dd: error writing ‘/tmp/bigfile’: No space left on device
 2048+0 records in
 2047+0 records out
 2147450880 bytes (2.1 GB) copied, 0.920556 s, 2.3 GB/s

 [htd at kiera ~]$ free -m
              total       used       free     shared    buffers cached
 Mem:          3745       1562       2183          0          0    773 
 -/+ buffers/cache:        787       2957
 Swap:         8191          0       8191

I have 4 GB of memory in my machine, and mount defaults to "size=50%"
(= 2GB). I have been running /tmp as a tmpfs a long time, because the
harddisk is a SSD. What happens can you see above: it creates a 2 GB
file and aborts for the next 1 GB. The machine has 8 GB of swap, and
nothing of it was used.

Disclaimer: this is not a rant against having /tmp using tmpfs. I'm
aware of the limitations, and have only encountered positive
experiences so far.



More information about the users mailing list