Before tmpfs existed, NetBSD included a memory-based file-system called mfs. mfs is is just an implementation of the regular ffs—designed for persistent storage—on top of the (volatile) virtual memory system. This means that mfs uses the same data structures as the on-disk implementation, rendering less than optimal performance and memory usage. As regards the latter, and in words of a NetBSD developer, the physical memory and swap space needed to back these pages constantly grows.

The NetBSD operating system was in a need of an efficient memory file-system that uses its own data structures to manage the stored files. The main design goal was to make it use the correct amount of memory to work correctly and efficiently; no more, no less. tmpfs fits this gap.

g5:~> uname -m -n -r -s
FreeBSD g5.meroh.net 13.0-STABLE powerpc
g5:~> date
Wed Feb 24 06:32:41 PST 2021
g5:~> mount | grep tmpfs
tmpfs on /tmp (tmpfs, local)

This project was developed under the Summer of Code 2005 program for NetBSD by me and was later ported to FreeBSD in 2008 by other people.

Related blog posts