TMPFS in Linux
As a linux daily user you might have noticed — when you check linux disk space with df command, there are some tmpfs file system along…
TMPFS in Linux
As a linux daily user you might have noticed — when you check linux disk space with df command, there are some tmpfs file system along with the normal filesystem -
Filesystem Size Used Avail Use% Mounted on
/dev/root 6.8G 5.5G 1.3G 81% /
tmpfs 479M 0 479M 0% /dev/shm
tmpfs 192M 992K 191M 1% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
/dev/xvda16 881M 133M 687M 17% /boot
/dev/xvda15 105M 6.1M 99M 6% /boot/efi
tmpfs 96M 12K 96M 1% /run/user/1000
Here we know about / and /boot . But what actually is other tmpfs that is mounted.
Let me start tmpfs from linux man page —
https://man7.org/linux/man-pages/man5/tmpfs.5.html
The tmpfs facility allows the creation of filesystems whose
contents reside in virtual memory. Since the files on such
filesystems typically reside in RAM, file access is extremely
fast.
The filesystem is automatically created when mounting a
filesystem with the type tmpfs via a command such as the
following:
$ sudo mount -t tmpfs -o size=10M tmpfs /mnt/mytmpfs
A tmpfs filesystem has the following properties:
• The filesystem can employ swap space when physical memory
pressure demands it.
• The filesystem consumes only as much physical memory and swap
space as is required to store the current contents of the
filesystem.
• During a remount operation (mount -o remount), the filesystem
size can be changed (without losing the existing contents of
the filesystem).
If a tmpfs filesystem is unmounted, its contents are discarded
(lost).
tmpfs also known as temporary files system, stores data in volatile memory (RAM). However, it is designed in such a way that it appears as normal linux filesystem.
Since the data is stored in RAM, the data access is very fast. However, data will be cleared once rebooted as tmpfs will get unmounted on reboot.
In Ubuntu, you can see from the df output — two filesystems are stored as tmpfs -
/dev/shm— filesystem that is used for shared memory segments for kernel/run— filesystem which stores data from run time programs which is just relevent only during booting.
So this is the concept of tmps in linux. Infact, if you have enough memory in your machine, tmpfs can help in many ways. Please do have interesting read on how mounting /tmp on tmpfs can help our environment. :)
https://ubuntu.com/blog/data-driven-analysis-tmp-on-tmpfs
메타데이터
- post_id
- 49509ba2e92b
- slug
- tmpfs-in-linux-49509ba2e92b
- url
- https://medium.com/@sajanpth/tmpfs-in-linux-49509ba2e92b
- canonical_url
- https://medium.com/@sajanpth/tmpfs-in-linux-49509ba2e92b
- author_url
- https://medium.com/@sajanpth
- status
- ok
- fetched_at
- 2026-06-27 18:20:27