Pcornel
Linux · Filesystems & Mounting

tmpfs

Cheat sheet · https://pcornel.dk/topic.php?topic=2757

Back to the Topic

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.

Remember

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.

First 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

Verify in this order

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

Where it usually breaks

First mismatch in hardware/block device → kernel driver/mapper/RAID/LVM → filesystem → mount namespace/options → path permissions/MAC → consumer I/O; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2757

Confirmation

Confirm action

Continue?