/tmp is getting full although it should have space left

I have an issue with the size of /tmp and that the settings are somehow not honored.

/tmp is mount as a tmpfs by systemd’s tmp.mount. I have 64GB of RAM and the options in tmp.mount say: Take 50% of that for /tmp. That is the default.

# /usr/lib/systemd/system/tmp.mount
#  SPDX-License-Identifier: LGPL-2.1-or-later
#
#  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=50%,nr_inodes=400k

When I do a df the 50% size is showing fine:

3# df /tmp 
Filesystem     Type   Size  Used Avail Use% Mounted on
tmpfs          tmpfs   32G   72M   32G   1% /tmp

But in fact /tmp is reporting full after 5.8G are being used

13# touch /tmp/aaa
touch: cannot touch '/tmp/aaa': No space left on device

14# df /tmp       
Filesystem     Type   Size  Used Avail Use% Mounted on
tmpfs          tmpfs   32G  5,8G   26G  19% /tmp

There is still plenty of RAM free:

total        used        free      shared  buff/cache   available
Mem:           64318        3372       53963        5943        6982       54295
Swap:           8191           0        8191

When I set the tmpfs size to a value like 10G I get the same thing: At 5.8G it is reporting full. Any idea where this limit is coming from?

have you also checked inodes ?

How do I do that? What do I need to look for?

checks

df /tmp -Hi

there is many things in tmpfs ( /tmp and /dev/shm and /run/user/nnnn )

Inodes seems to be the problem. Although I have not yet checked inode numbers I see that I can copy big files to /tmp and easily consume the full 32G. The limit seems to be the number of files.

That is interesting. I never thought about that limit. I use to do kernel compilations in /tmp. With several kernel source trees in /tmp I am reaching the limit.

What would be the downside of increasing nr_inodes=400k ?

Is it possible to reduce the number of inodes that are actually going to /tmp and related places?