tmpfs-config(5)
tmpfs-config β the tmpfs-config(5) glow-up π
okay so bestie, this is a page from the Debian Administrator's Manual, and it's all about the little file that decides which tmpfs filesystems get mounted while your machine is still waking up. pull up a chair, we're getting into it π«Ά
β¨ NAME β¨
tmpfs-config β the variables that configure tmpfs filesystems mounted during boot. that's it, that's the whole vibe π
πΈ DESCRIPTION πΈ
So. The file /etc/default/tmpfs is where all the magic lives. It holds variable settings in POSIX format, which looks like this:
VAR=VAL
Rules of the house, no cap:
- Only one assignment per line. one. that's the limit.
- Comments are allowed, and they start with
#.
This file configures tmpfs filesystems that get mounted in early boot β like, before the filesystems from /etc/fstab even show up. currently that means these four: /run, /run/lock, /run/shm and /tmp. let's break them down one by one, because each one has its own lil personality π¦
A couple of ground rules first, fr fr:
/runis required to be atmpfson systems that supporttmpfsmounts. not optional, bestie./run/lockand/run/shmmay be separatetmpfsmounts, which is genuinely useful if you want to enforce separate size limits on them. obsessed with the flexibility honestly./tmpis not required to be atmpfs, and it is not mounted as atmpfsby default. it's just living its life as part of the root filesystem unless you say otherwise.
π /run
Previously configured using RAMRUN in /etc/default/rcS, /run is now always mounted as a ram file system (tmpfs). the size of the tmpfs can be controlled using TMPFS_SIZE and RUN_SIZE.
if you want, the defaults may also be overridden with an entry in in /etc/fstab, for example:
tmpfs /run tmpfs nodev,nosuid,size=10%,mode=755 0 0
Now for the real talk π:
- The contents of
/runwill always be lost on system reboot, and it it is no longer explicitly cleaned at boot. - Packages can not expect directories in
/runto exist after boot. packages that expect this are buggy and need to be fixed. periodt. - Note that
/runwas previously/var/run, and a compatibility symlink or bind mount will be created to allow the old path to continue to function. so your old paths still slay, they're just cosplaying π
π /run/lock
Previously configured using RAMLOCK in /etc/default/rcS. configured using RAMLOCK, TMPFS_SIZE and LOCK_SIZE.
if you want, the defaults may also be overridden with an entry in in /etc/fstab, for example:
tmpfs /run/lock tmpfs nodev,noexec,nosuid,size=52428800,mode=1777 0 0
now the important bit β irrespective of these settings, /run/lock will be located on a tmpfs, either one mounted on /run/lock (if RAMLOCK=yes) or one mounted on /run (if RAMLOCK=no). so either way it's on a tmpfs, bestie. and as a result:
- the contents of
/var/lockwill always be lost on system reboot, and it it is no longer explicitly cleaned at boot. - Packages can not expect directories in
/var/lockto exist after boot. packages expecting this are buggy and need to be fixed. - Note that
/run/lockwas previously/var/lock, and a compatibility symlink or bind mount will be created to allow the old path to continue to function. iconic behavior honestly π
π /run/shm
Previously configured using RAMSHM in /etc/default/rcS. heads up though: the setting in /etc/default/rcS, if present, will still be used, but the setting in /etc/default/tmpfs will take precedence if enabled. so the new file wins, no debate.
Configured using RAMSHM, TMPFS_SIZE and SHM_SIZE. and if you want, the defaults may also be overridden with an entry in in /etc/fstab, for example:
tmpfs /run/shm tmpfs nosuid,nodev,size=40%,mode=1777 0 0
- Packages can not expect directories in
/run/shmto exist after boot. - Note that
/run/shmwas previously/dev/shm, and a compatibility symlink or bind mount will be created to allow the old path to continue to function. - Special case alert π¨: if an
fstabentry for/dev/shmexists instead of/run/shm, then/dev/shmwill continue to be used. note that this is only needed for users of newer versions of the Oracle database, which contain a buggy check for/dev/shm. yep. that's the reason. not me being salty about it π
π /tmp
Previously configured using RAMTMP in /etc/default/rcS. same deal as above: the setting in /etc/default/rcS, if present, will still be used, but the setting in /etc/default/tmpfs will take precedence if enabled.
Configured using RAMTMP, TMPFS_SIZE and TMP_SIZE. and if you want, the defaults may also be overridden with an entry in in /etc/fstab, for example:
tmpfs /tmp tmpfs nodev,nosuid,size=20%,mode=1777 0 0
- Packages can not expect directories in
/tmpto exist after boot. that's the whole bullet. short and devastating π
NOTE: This file is ignored when systemd is used as init system. so if you're on systemd, this whole page is basically a museum exhibit ποΈβ¨
π OPTIONS π
The following variables can be set. let's go through every single one because we do not skip β
π Enabling or disabling tmpfs mounts
The following options enable specific mounts (with the exception of /run) to be enabled or disabled. note that the addition of an entry to /etc/fstab for any of the following will enable the mount unconditionally, overriding the setting here. fstab said what it said π
RAMLOCKβ Mount/run/lockas atmpfs(separately from/run). defaults toyes; set tonoto disable (and then/run/lockwill be part of the/runtmpfs, if available).RAMSHMβ Mount/run/shmas atmpfs(separately from/run). defaults toyes; set tonoto disable (and then/run/shmwill be part of the/runtmpfs, if available).RAMTMPβ Mount/tmpas atmpfs. defaults tono; set toyesto enable (and then/tmpwill be part of the root filesystem if disabled)./tmpmay also be configured to be a separate mount in/etc/fstab, which will override theRAMTMPsetting.
π Configuring size limits for tmpfs mounts
The following options configure size limits for tmpfs mounts. note that the addition of an entry to /etc/fstab will override any of the limits specified here. fstab stays undefeated π€
The following _SIZE variables are the maximum size (in bytes) that tmpfs filesystems can use. The size will be rounded down to a multiple of the page size, 4096 bytes. If no size is set, TMPFS_SIZE will be used as the default.
More complex mount options may be used by the creation of a suitable entry in /etc/fstab. For example:
tmpfs /run tmpfs size=10% 0 0
is equivalent to
RUN_SIZE=10%
and will override the RUN_SIZE setting. This will allow additional options such as nr_blocks and nr_inodes to be used, and also adjustment of the mode, nodev, nosuid, noexec options should any change from the defaults be necessary. so many knobs, so little time ποΈ
TMPFS_SIZEβ Maximum size for alltmpfsfilesystems if no specific size is provided. The default is20%VM(20% of virtual memory, including swap space). If this is explicitly set to an empty string, the kernel default (50% RAM) will be used. Note that the"%VM"suffix may be used in this and all the_SIZEsettings below, but may not be used in/etc/fstab(the absolute size is calculated by the init scripts).RUN_SIZEβ Maximum size of/run(was previously/var/run). The default is10%core memory; the size required varies widely depending upon the demands of the software being run; this heuristic scales/runusage on system size.Sambain particular has been seen to use at least50MiBin a large heavily used server. Typical usage is hundreds ofKiB, maximum is tens ofMiB. samba really said "i will consume" πLOCK_SIZEβ Maximum size of/run/lock(was previously/var/lock). Defaults to5242880(5 MiB). Typical usage: tens ofKiB; maximum hundreds ofKiB. The default of5 MiBshould ensure the limit is never reached. comfy default, we love to see it π«ΆSHM_SIZEβ Maximum size of/run/shm(was previously/dev/shm). No default size; the size required varies widely depending upon the demands of the software being run.TMP_SIZEβ Maximum size of/tmp. No default size.
π Emergency overflow /tmp
If the amount of free space on the root filesystem falls below a certain size, a tmpfs will be mounted on /tmp (irrespective of the RAMTMP setting, which this overrides). This is to permit logins when there would otherwise be too little free space for this to be possible. emergency girlypop behavior, but make it functional π¨
TMP_OVERFLOW_LIMITβ Mount atmpfson/tmpif the amount of free space on the root filesystem is below the specified limit at boot time (default1024 KiB).
π AUTHOR π
Roger Leigh <rleigh@debian.org>
π¦ SEE ALSO π¦
and that's the whole page, bestie!! this one's from 18 Feb 2012, it's page tmpfs-config(5) from the Debian Administrator's Manual, and yes i read the entire thing so you didn't have to. go forth and configure your tmpfs responsibly πβ¨π
π¦ where this page comes from
- debian trixie: initscripts 3.14-4 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms