Using tmpfs in /tmp

I've been stalling moving /tmp to RAM ever since i first bought a SSD for my computer last year. Now when i finally got the energy i read a bit about it and it was almost too easy. Just add this line to fstab then restart or run mount -a and it should work.

tmpfs /tmp tmpfs defaults,nosuid,size=1024M,mode=1777 0 0

I'm pretty sure the mount options can be better tweaked. Here is an excerpt from the documentation.
tmpfs has three mount options for sizing:
size:      The limit of allocated bytes for this tmpfs instance. The 
default is half of your physical RAM without swap. If you
oversize your tmpfs instances the machine will deadlock
since the OOM handler will not be able to free that memory.
nr_blocks: The same as size, but in blocks of PAGE_CACHE_SIZE.
nr_inodes: The maximum number of inodes for this instance. The default
is half of the number of your physical RAM pages, or (on a
machine with highmem) the number of lowmem RAM pages,
whichever is the lower.


John said...

Are you a professional journalist? You write very well.

123 said...