Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

tmpfs

Direct answer

tmpfs is a filesystem in memory (and swap), used for /run, /dev/shm and often /tmp. Its contents disappear at unmount or reboot; size limits memory use.

When to use this

Use it for fast temporary data, or when /tmp or /dev/shm fills up.

First 30 seconds

1. df -h /tmp /dev/shm /run — usage.

2. Biggest files: du -sh /tmp/* | sort -h | tail.

3. Change size: mount -o remount,size=2G /tmp (persist in fstab).

4. Memory pressure? free -h.

5. Clean up the writer.

Operational verification

tmpfs mounted with a size → files kept in page cache → counted as memory → gone at reboot

Evidence · next step

For Filesystems & Mounting → tmpfs, continue with the first unproven Topic check: Identify tmpfs mountpoint, namespace, size/inode limits and options. If that boundary is healthy, advance to the adjacent check: Compare actual tmpfs usage with RAM/swap pressure at the same timestamp. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.

Continue only after interpreting the current observation.
Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
linux
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformlinux
Key commandfindmnt -t tmpfs
Scope / prerequisiteUse it for fast temporary data, or when /tmp or /dev/shm fills up.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

5 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Operational evidence path Verify boundary

RAM/swap availability → tmpfs superblock + limits → mount namespace → files/pages/inodes → process references → memory pressure/workload

Healthy evidence: the intended tmpfs mount has suitable limits, actual pages/inodes stay within capacity, host memory remains healthy and consumers accept non-persistent semantics.

Step 2 Verification and output interpretation Verify boundary

Existing fast checks for this Topic. - Identify tmpfs mountpoint, namespace, size/inode limits and options.

  • Compare actual tmpfs usage with RAM/swap pressure at the same timestamp.
  • Check for open deleted files or processes retaining tmpfs-backed data.
  • Verify consumers tolerate tmpfs volatility and intended capacity limits.

Verification chain. RAM/swap availability → tmpfs superblock + limits → mount namespace → files/pages/inodes → process references → memory pressure/workload

Step 3 Commands Verify boundary
mount -t tmpfs -o size=1G tmpfs /mnt/tmp
findmnt -t tmpfs
Step 4 Failure modes and next checks Narrow the fault

Suspicious evidence: tmpfs growth contributes to swap/OOM pressure, inode limits are exhausted, or a workload incorrectly assumes tmpfs data is durable.

tmpfs evidence shows filesystem allocation and limits, not total host memory health or persistence across reboot.

Step 5 Common mistakes Narrow the fault
  • tmpfs without size limit consuming RAM.
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points

Default size is half of RAM. Data written there uses memory — a full tmpfs can cause memory pressure. Set size in fstab or with systemctl edit tmp.mount.

Key checks
  • findmnt — mount tree with options
  • df -hT — usage and filesystem types
  • findmnt --verify — check /etc/fstab
  • dmesg -T | grep -iE 'ext4|xfs|btrfs' — filesystem kernel messages
ReferenceWhat it is1 section · depth on demand

Core model

Treat tmpfs capacity and system memory pressure as related but distinct. Identify the exact mount namespace, configured size/inode limits and actual usage. A large tmpfs size option does not mean that much RAM is consumed, while heavy tmpfs usage can contribute to memory/swap pressure.

ReferenceImportant terms & boundaries5 sections · depth on demand

What this shows and what it does not

tmpfs evidence shows filesystem allocation and limits, not total host memory health or persistence across reboot.

In depth

tmpfs: file systems in memory

tmpfs keeps files in virtual memory, in the kernel's page cache. Its pages can move to swap when memory is short. The kernel's tmpfs documentation describes its behaviour:

  • The size defaults to 50 % of RAM if no size is given, and a percentage is allowed.
  • nr_inodes limits the number of files.
  • mode, uid and gid set the root directory's permissions.
  • The size can be changed with a remount, but not below the current use.
  • Everything is lost at unmount.
  • Oversizing tmpfs instances can exhaust memory and deadlock the machine.
  • noswap keeps the contents out of swap, and huge= controls transparent huge pages.

Where tmpfs is used

MountPurpose
/runRuntime state since boot
/dev/shmPOSIX shared memory
/tmp (many distributions)Fast temporary files, cleared at reboot
/run/user/<uid>Per-user runtime directory
Build directories, cachesSpeed

tmpfs and memory accounting

PointDetail
Counts as "shared" or "Shmem" memoryIt appears under buff/cache in free
Can't be freed by dropping cachesThe data has to be deleted
Is charged to the cgroup that wrote itA container's tmpfs counts against its memory limit
SwappableUnless noswap is set

Sizing

Several tmpfs mounts, each defaulting to half of RAM, can together promise more memory than exists. Set explicit sizes on mounts that untrusted users or applications can fill. A full tmpfs gives "No space left on device", which is much better than an out-of-memory situation.

host$ findmnt -t tmpfs -o TARGET,SIZE,USED,OPTIONS
TARGET          SIZE  USED OPTIONS
/dev/shm        7.8G   12M rw,nosuid,nodev
/run            1.6G  2.1M rw,nosuid,nodev,noexec,relatime,size=1631708k,mode=755
/tmp            4.0G  220M rw,nosuid,nodev,size=4194304k
host$ grep -E "^(Shmem|MemTotal):" /proc/meminfo
host$ sudo mount -o remount,size=6G /tmp
host$ echo 'tmpfs /srv/build tmpfs size=8G,mode=0750,uid=builder,gid=builder,noswap 0 0' | sudo tee -a /etc/fstab
host$ sudo mount /srv/build && df -h /srv/build

Reading the example

/dev/shm has no explicit size, so it may grow to the default 50 % of RAM. /tmp is limited to 4 GiB and can be resized online with a remount. The new build area keeps its data out of swap with noswap, which avoids slow swapping of build artefacts.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

How it works at runtime

tmpfs is part of Filesystems & Mounting → tmpfs. tmpfs is a memory-backed filesystem whose pages can consume RAM and swap while presenting a filesystem interface; its configured size is a limit, not necessarily preallocated physical memory.

Topic-specific state model. tmpfs is a memory-backed filesystem whose pages can consume RAM and swap while presenting a filesystem interface; its configured size is a limit, not necessarily preallocated physical memory.

Interpretation rule. - tmpfs size limit ≠ RAM reserved immediately.

  • Filesystem free space ≠ system memory headroom.
  • tmpfs mounted ≠ data survives reboot.
  • Deleting visible files ≠ every open-unlinked tmpfs page is freed immediately.

Quick reference

tmpfs is a RAM-backed filesystem (swappable). Used for /run, /dev/shm, often /tmp.

mount -t tmpfs -o size=2G,mode=1777,nodev,nosuid tmpfs /tmp
findmnt -t tmpfs
df -h /dev/shm
# fstab
tmpfs /var/cache/app tmpfs size=512m,uid=app,gid=app,mode=0750 0 0

Size defaults to 50 % of RAM but memory is only used as files are written. Large tmpfs usage competes with application memory and can trigger OOM; set explicit size= limits.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Limits and how it fails

Primary failure point. tmpfs evidence shows filesystem allocation and limits, not total host memory health or persistence across reboot.

ReferenceConfiguration & state1 section · depth on demand

Configuration, persistence and lifecycle

Distribution/platform context. tmpfs owns memory-backed filesystem semantics. Resource Monitoring owns whole-host memory pressure; applications own persistence requirements.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor doclinux current

Authoritative/upstream documentation reviewed for bounded claims in Filesystems & Mounting → tmpfs. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://docs.kernel.org/filesystems/index.html · confidence 94%
Technical changelog & impact

What changed and what may be affected

Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
tmpfs linuxmemory filesystem linuxtmpfs sizetmpfs ram swap
Embedded reference data

Quick lookup tables

tmpfs operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for tmpfs.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective statetmpfs is a memory-backed filesystem whose pages can consume RAM and swap while presenting a filesystem interface; its configured size is a limit, not necessarily preallocated physical memory.Establish exactly what this Topic owns before crossing into another subsystem.
Fast verificationPin host + incident/change time → capture block topology and stable identities → validate partition/device metadata → validate filesystem identity/integrity and effective mount namespace/options → validate PV/VG/LV/device-mapper state where used → make one controlled change at the first failed boundary → re-read effective storage state → repeat original workload I/O/acceptance test.Use the shortest evidence path first; a fast check is a boundary test, not blanket proof.
Verification chainRAM/swap availability → tmpfs superblock + limits → mount namespace → files/pages/inodes → process references → memory pressure/workloadTrace requested/configured state through effective state to the observed workload result.
Failure boundarytmpfs evidence proves filesystem allocation and limits, not total host memory health or persistence across reboot.Stop broad troubleshooting at the first boundary that is not supported by evidence.
Positive evidenceCorrelated Linux storage evidence can establish this proof path: RAM/swap availability → tmpfs superblock + limits → mount namespace → files/pages/inodes → process references → memory pressure/workloadUse this observation only for the specific claim it actually supports.
Evidence limitIt does not independently prove behavior outside the captured device, metadata, mapping, mount or workload scope. tmpfs evidence proves filesystem allocation and limits, not total host memory health or persistence across reboot.Do not promote a local success signal into end-to-end or adjacent-dependency proof.
Next troubleshooting checkContinue from the first unproven boundary: prove backing identity, then on-device metadata, then filesystem/LVM mapping and effective mount/device state, and finally repeat the original workload I/O before any additional storage change.Continue to the next unresolved boundary while preserving the original test condition.

tmpfs · operational reference

Compact Linux state, persistence, verification and boundary reference for fast lookup.

Reference boundarytmpfs
Topic pathFilesystems & Mounting → tmpfs
Runtime statetmpfs is a memory-backed filesystem whose pages can consume RAM and swap while presenting a filesystem interface; its configured size is a limit, not necessarily preallocated physical memory.
Fast checks- Identify tmpfs mountpoint, namespace, size/inode limits and options. - Compare actual tmpfs usage with RAM/swap pressure at the same timestamp. - Check for open deleted files or processes retaining tmpfs-backed data. - Verify consumers tolerate tmpfs volatility and intended capacity limits.
Verification chainRAM/swap availability → tmpfs superblock + limits → mount namespace → files/pages/inodes → process references → memory pressure/workload Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary.
Failure boundarytmpfs evidence proves filesystem allocation and limits, not total host memory health or persistence across reboot. Boundary chain: process credentials/namespace → path/mount lookup → DAC/ACL/LSM → filesystem metadata → block/device/backend → completion/read-back.
Persistence ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.
Confirmation

Confirm action

Continue?