1

I have a virtual server (Debian 8.5, OpenVZ) that seems to run out of memory* when tmpfs-based /tmp is about 60% full.

(* while the system reports 2GB of memory still free, processes start to behave erratically, /tmp writes fail with ENOSPC, forking fails with ENOMEM, some connections drop with ENOBUFS, and eventually sshd starts closing connections during handshake).

Is this normal for tmpfs, or is my system somehow horribly misconfigured?

Can it be fixed by shrinking size of /tmp?

How can I resize /tmp if it's not in /etc/fstab?


Filesystem         Size  Used Avail Use% Mounted on
/dev/ploop25777p1  150G   19G  126G  13% /
devtmpfs           2.0G     0  2.0G   0% /dev
tmpfs              2.0G     0  2.0G   0% /dev/shm
tmpfs              2.0G   17M  2.0G   1% /run
tmpfs              5.0M     0  5.0M   0% /run/lock
tmpfs              2.0G     0  2.0G   0% /sys/fs/cgroup
tmpfs              2.0G   68K  2.0G   1% /tmp
none               2.0G     0  2.0G   0% /run/shm
proc  /proc       proc    defaults    0    0
none  /dev/pts    devpts  rw,gid=5,mode=620    0    0
none  /run/shm    tmpfs   defaults    0    0
Kornel
  • 1,075
  • 1
  • 11
  • 16

1 Answers1

1

tmpfs is a filesystem in memory, that can hog your memory if you have a lot of tmp files that do not get cleaned up.

You can use the filesystem for /tmp by editing /etc/default/tmpfs and reboot.

But you should really find out why /tmp is filling up.

Edit: You can also limit the size in the file...

lazyfrosch
  • 790
  • 4
  • 10
  • My program is deliberately filling up tmp as long as there's more than 10% free space on /tmp. The problem is that machine dies long before tmp is full. – Kornel Jul 28 '16 at 17:14
  • Then you should either limit the size, or move to disk. – lazyfrosch Jul 29 '16 at 07:01