Sobes.tech
Junior — Middle

Explain what a tmpfs temporary file system is and how it works in Linux.

sobes.tech AI

Answer from AI

tmpfs is a temporary file system in Linux that stores data in RAM instead of on disk. It is used for fast access to temporary files and is usually mounted at /tmp.

How it works:

  • When data is written to tmpfs, it is stored in RAM, providing very high read/write speeds.
  • Data in tmpfs is not preserved after system reboot — it is temporary storage.
  • The size of tmpfs can dynamically change, limited by a set limit or available memory.

Example of mounting tmpfs:

mount -t tmpfs -o size=512M tmpfs /mnt/tmpfs

This creates a temporary file system of 512MB at /mnt/tmpfs.