mirror of
https://github.com/systemd/systemd.git
synced 2024-11-05 06:52:22 +03:00
7d85383edb
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.
26 lines
793 B
SYSTEMD
26 lines
793 B
SYSTEMD
# SPDX-License-Identifier: LGPL-2.1+
|
|
#
|
|
# This file is part of systemd.
|
|
#
|
|
# systemd is free software; you can redistribute it and/or modify it
|
|
# under the terms of the GNU Lesser General Public License as published by
|
|
# the Free Software Foundation; either version 2.1 of the License, or
|
|
# (at your option) any later version.
|
|
|
|
[Unit]
|
|
Description=Temporary Directory (/tmp)
|
|
Documentation=https://systemd.io/TEMPORARY_DIRECTORIES
|
|
Documentation=man:file-hierarchy(7)
|
|
Documentation=https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems
|
|
ConditionPathIsSymbolicLink=!/tmp
|
|
DefaultDependencies=no
|
|
Conflicts=umount.target
|
|
Before=local-fs.target umount.target
|
|
After=swap.target
|
|
|
|
[Mount]
|
|
What=tmpfs
|
|
Where=/tmp
|
|
Type=tmpfs
|
|
Options=mode=1777,strictatime,nosuid,nodev,size=10%,nr_inodes=400k
|