TMPFS(4)
π TMPFS(4) β the in-memory file system that's literally iconic (Kernel Interfaces Manual, bestie) π
okay so this is the TMPFS(4) page from the Kernel Interfaces Manual, and I'm about to spill all the tea on tmpfs, the in-memory file system that's serving low-latency realness π
πΈ NAME πΈ
tmpfs β in-memory file system. That's it, that's the whole name, and it's already slaying. π
π¦ SYNOPSIS π¦
Okay bestie, if you want to compile this driver into the kernel (which is giving full commitment energy), you place this line in your kernel configuration file:
options TMPFS
Alternatively β and this is the low-key easier way to do it β if you want to load the driver as a module at boot time, you put this line in loader.conf(5):
tmpfs_load="YES"
β¨ DESCRIPTION β¨
The tmpfs driver implements an in-memory, or tmpfs file system. The filesystem stores both file metadata and data in main memory. This allows very fast and low latency accesses to the data. The data is volatile. An umount or system reboot invalidates it. These properties make the filesystem's mounts suitable for fast scratch storage, like /tmp. π¨
If the system becomes low on memory and swap is configured (see swapon(8)), the system can transfer file data to swap space, freeing memory for other needs. Metadata, including the directory content, is never swapped out by the current implementation. Keep this in mind when planning the mount limits, especially when expecting to place many small files on a tmpfs mount. π§
When mmap(2) is used on a file from a tmpfs mount, the swap VM object managing the file pages is used to implement mapping and avoid double-copying of the file data. This quirk causes process inspection tools, like procstat(1), to report anonymous memory mappings instead of file mappings. π (So like, it's not a bug, it's a feature, okay?)
π OPTIONS π
The following options are available when mounting tmpfs file systems:
easizeβ Set the maximum memory size used by extended attributes in bytes. The default is 16 megabytes. πΎexportβ Accept theexportoption for compatibility withnfsv4(4). This option does nothing. (Like, literally nothing. It's just there for vibes. π)gidβ Set the group ID of the root inode of the file system. The default is the mount point's GID. π₯inodesβ Set the maximum number of nodes available to the file system. If not specified, the file system chooses a reasonable maximum based on the file system size, which can be limited with thesizeoption. π’maxfilesizeβ Set the maximum file size in bytes. The default is the maximum possible value. (Go big or go home, right? π)modeβ Set the mode (in octal notation) of the root inode of the file system. The default is the mount point's mode. πnomtimeβ Disable the tracking of mtime updates caused by writes to the shared mapped areas backed bytmpfsfiles. This option removes periodic scans, which downgrade read-write-mapped pages to read-only to note the writes. β°noncβ Do not use namecache to resolve names to files for the created mount. This saves memory, but currently might impair scalability for highly used mounts on large machines. (Memory savings but potential scalability tea π )nosymfollowβ Do not followsymlink(7)'son the mounted file system. π«pgreadβ Enable pgcache read for the mount. πsizeβ Set the total file system size in bytes, unless suffixed with one ofk,m,g,t, orp, which denote byte, kilobyte, megabyte, gigabyte, terabyte and petabyte respectively. If zero (the default) or a value larger thanSIZE_MAX - PAGE_SIZEis given, the available amount of memory (including main memory and swap space) will be used. πuidβ Set the user ID of the root inode of the file system. The default is the mount point's UID. π€unionβ Refer tomount(8). (iykyk) π
π SYSCTL VARIABLES π
The following sysctl(8) variables are available:
vfs.tmpfs.memory_percentβ The percentage of memory plus swap space available at kernel file system initialization that can be used by a file system with a size of 0. When this amount of space in use is reached, new files cannot be created and files cannot be extended. The default is 95%. Changing this value also changesvfs.tmpfs.memory_reserved. πvfs.tmpfs.memory_reservedβ The currently-reserved amount of memory plus swap space based on the memory percentage. The minimum is compiled into the system, and defaults to 4 MB. π
π EXAMPLES π
Mount a tmpfs memory file system (the classic move):
mount -t tmpfs tmpfs /tmp
Configure a tmpfs mount via fstab(5):
tmpfs /tmp tmpfs rw 0 0
π SEE ALSO π
π¦ HISTORY π¦
The tmpfs driver first appeared in FreeBSD 7.0. (A classic, honestly. The way it's been serving since 7.0 π
) β
π AUTHORS π
- The
tmpfskernel implementation was written by Julio M. Merino Vidal<jmmv@NetBSD.org>as a Google Summer of Code project. π - Rohit Jalan and others ported it from NetBSD to FreeBSD. πͺ
- This manual page was written by Xin LI
<delphij@FreeBSD.org>. βοΈ
π and that's the tea, bestie! this page is from Debian, dated September 18, 2023, and it's TMPFS(4). mwah! πβ¨
π¦ where this page comes from
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2007 Xin LI
- Copyright (c) 2017 The FreeBSD Foundation
- Copyright (c) 2005, 2006 The NetBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms