Use it for fast temporary data, or when /tmp or /dev/shm fills up.
tmpfs
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.
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.
tmpfs mounted with a size → files kept in page cache → counted as memory → gone at reboot
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
Operational reference
Fast context before you go deeper.
findmnt -t tmpfsVerification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
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 · 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.
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.
findmnt— mount tree with optionsdf -hT— usage and filesystem typesfindmnt --verify— check /etc/fstabdmesg -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
sizeis given, and a percentage is allowed. nr_inodeslimits the number of files.mode,uidandgidset 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.
noswapkeeps the contents out of swap, andhuge=controls transparent huge pages.
Where tmpfs is used
| Mount | Purpose |
|---|---|
/run | Runtime state since boot |
/dev/shm | POSIX shared memory |
/tmp (many distributions) | Fast temporary files, cleared at reboot |
/run/user/<uid> | Per-user runtime directory |
| Build directories, caches | Speed |
tmpfs and memory accounting
| Point | Detail |
|---|---|
| Counts as "shared" or "Shmem" memory | It appears under buff/cache in free |
| Can't be freed by dropping caches | The data has to be deleted |
| Is charged to the cgroup that wrote it | A container's tmpfs counts against its memory limit |
| Swappable | Unless 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.
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.
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
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
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%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.
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.
Quick lookup tables
tmpfs operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for tmpfs.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | 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. | Establish exactly what this Topic owns before crossing into another subsystem. |
| Fast verification | Pin 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 chain | RAM/swap availability → tmpfs superblock + limits → mount namespace → files/pages/inodes → process references → memory pressure/workload | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | tmpfs 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 evidence | Correlated Linux storage evidence can establish this proof path: RAM/swap availability → tmpfs superblock + limits → mount namespace → files/pages/inodes → process references → memory pressure/workload | Use this observation only for the specific claim it actually supports. |
| Evidence limit | It 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 check | Continue 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 boundary | tmpfs |
|---|---|
| Topic path | Filesystems & Mounting → tmpfs |
| Runtime state | 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. |
| 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 chain | RAM/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 boundary | tmpfs 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 rule | Prove which configuration source owns the state, then prove that the running consumer loaded or generated the intended state. |