diff options
author | Topi Miettinen <toiwoton@gmail.com> | 2020-04-14 15:39:36 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2020-05-13 00:37:18 +0200 |
commit | 7d85383edbab73274dc81cc888d884bb01070bc2 (patch) | |
tree | 90330d1a7a1bceec1225c200de55d84d52889bf8 /units/tmp.mount | |
parent | update TODO (diff) | |
download | systemd-7d85383edbab73274dc81cc888d884bb01070bc2.tar.xz systemd-7d85383edbab73274dc81cc888d884bb01070bc2.zip |
tree-wide: add size limits for tmpfs mounts
Limit size of various tmpfs mounts to 10% of RAM, except volatile root and /var
to 25%. Another exception is made for /dev (also /devs for PrivateDevices) and
/sys/fs/cgroup since no (or very few) regular files are expected to be used.
In addition, since directories, symbolic links, device specials and xattrs are
not counted towards the size= limit, number of inodes is also limited
correspondingly: 4MB size translates to 1k of inodes (assuming 4k each), 10% of
RAM (using 16GB of RAM as baseline) translates to 400k and 25% to 1M inodes.
Because nr_inodes option can't use ratios like size option, there's an
unfortunate side effect that with small memory systems the limit may be on the
too large side. Also, on an extremely small device with only 256MB of RAM, 10%
of RAM for /run may not be enough for re-exec of PID1 because 16MB of free
space is required.
Diffstat (limited to 'units/tmp.mount')
-rw-r--r-- | units/tmp.mount | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/units/tmp.mount b/units/tmp.mount index 27bd0f235c..7066e52261 100644 --- a/units/tmp.mount +++ b/units/tmp.mount @@ -22,4 +22,4 @@ After=swap.target What=tmpfs Where=/tmp Type=tmpfs -Options=mode=1777,strictatime,nosuid,nodev +Options=mode=1777,strictatime,nosuid,nodev,size=10%,nr_inodes=400k |