Skip to content
Latchkey

What Is a tmpfs? An In-Memory Filesystem

A tmpfs is a filesystem that stores its files in memory (RAM) instead of on a disk, making it very fast but volatile.

A tmpfs puts files in RAM rather than on persistent storage. Reads and writes are extremely fast, but everything vanishes when the system reboots or the mount is removed. On Unix, locations like /tmp or /dev/shm are often backed by tmpfs. In CI, a tmpfs can dramatically speed up build steps that thrash the filesystem.

What a tmpfs is

A tmpfs is an in-memory filesystem. Files written to it live in RAM (spilling to swap if needed), so access is fast, but the contents do not survive a reboot or unmount.

Speed versus persistence

Because there is no disk involved, a tmpfs avoids disk latency entirely, which is great for temporary, throwaway data. The trade-off is volatility: anything you need to keep must be copied elsewhere before the mount goes away.

Where you see it

  • /tmp is often backed by tmpfs on Linux.
  • /dev/shm is a tmpfs for shared memory.
  • Containers can mount a tmpfs for scratch space.

Memory is the limit

A tmpfs consumes RAM, so writing a large amount of data to it can exhaust memory and trigger an out-of-memory kill. Its size is bounded by available memory, unlike a roomy disk.

tmpfs in CI

Builds and tests that do heavy temporary I/O, like compilers and test suites, can run noticeably faster when their scratch directory sits on a tmpfs. The catch is memory: a build that writes gigabytes of temp data to tmpfs can run the runner out of RAM.

Fast scratch on managed runners

On Latchkey runners, pointing a build's temp directory at a tmpfs can speed up I/O-bound steps, provided the runner has enough memory. Right-sizing the runner gives the headroom to enjoy the speed without an out-of-memory kill.

Key takeaways

  • A tmpfs is an in-memory filesystem: very fast but volatile.
  • Locations like /tmp and /dev/shm are often backed by tmpfs.
  • In CI, tmpfs can speed up I/O-heavy steps but is bounded by RAM.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →