1. What is tmpfs ?
  2. How does it work ?
  3. Why do I need it ?
  4. How do I use it ?
  5. Testing tmpfs
  6. Editing fstab
  7. Caveats
  8. See also
  9. View source code (Please report any bugs or suggestions here).

What is tmpfs ?

tmpfs is an efficient memory file system written by Julio M. Merino Vidal during the Summer of Code Project in 2005. It was merged into the NetBSD tree on the 10th of September 2005. Tmpfs left experimental status on 11/11/2006 and is now enabled by default in all GENERIC kernels.

How does it work ?

In the contrary to mfs, tmpfs uses its own data structures to manage the stored files. It uses the correct amount of memory to work correctly and efficiently, which means it grows and shrinks.

Why do I need it ?

Normally you don't. You can work with your hard disk. But you can use it to reduce hard disk activity, if you store temporary data to tmpfs, which is faster aswell. I personally prefer tmpfs for /tmp and use it on all my servers.

How do I use it ?

Before you can use tmpfs, you have to rebuild your Kernel. To enable TMPFS please ensure that the line

file-system TMPFS 

is available and uncommented in your Kernel config file. Now, rebuild your Kernel and reboot.

Testing tmpfs

Before we change the file /etc/fstab, we have to ensure, that tmpfs is working. Otherwise your server won't be able to boot. To test if tmpfs is working, mount it manually with:

# mount_tmpfs tmpfs /tmp

and check, if it is mounted:

# mount
tmpfs on /tmp type tmpfs (local)

Editing fstab

You can now edit your /etc/fstab to mount it automatically everytime you boot. Please add exactly this line to your /etc/fstab:

tmpfs /tmp tmpfs rw 

You're done. Have fun.


Unfortunately tmpfs doesn't support whiteouts yet. That's why it can't be used with union_mount's.

See also

View source code (Please report any bugs or suggestions here).

Add a comment