TransWikia.com

/tmp full but... empty

Unix & Linux Asked by Clément Moissard on December 31, 2021

In a Python program, I use np.memmaps, which make use of the /tmp directory to handle massive arrays.
I make sure to clear /tmpregularly by running rm -rf /tmp/* every time I use this code. However recently, my code stopped working and threw me a "Bus error (core dumped)".

Now, even using auto-completion in the terminal results in: bash: cannot create temp file for here-document: No space left on device.

typing df -h gives me, I think, the culprit:

tmpfs            32G   32G     0 100% /tmp

However, running sudo rm -rf /tmp/* only puts me back to

tmpfs            32G   30G  1,9G  94% /tmp

Any idea what is going on and how to fix it?

One Answer

This command will let you learn the truth:

sudo lsof -n | grep /tmp |grep deleted

In Unix deleted files still exist in the filesystem and take space in it until the application using them closes the files or this application is terminated.

So, find the processes that have open deleted files and restart or terminate them.

It would be great to forcefully close the said file descriptors without terminating the apps using them but the Linux kernel doesn't support the revoke() system call: https://bugzilla.kernel.org/show_bug.cgi?id=14505

Answered by Artem S. Tashkinov on December 31, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP