On Wed, 2023-11-08 at 19:08 +0000, Neil Bothwick wrote:
> On Wed, 8 Nov 2023 16:17:19 +0200, Alan McKinnon wrote:
> 
> > On Wed, Nov 8, 2023 at 4:10 PM Neil Bothwick <n...@digimed.co.uk>
> > wrote:
> > 
> > > I have PORTAGE_TMPDIR on /tmp, which is a 24GB tmpfs. Last night,
> > > an
> > > update failed with an out of space error. df showed only 440MB
> > > free
> > > but du and ndcu both showed well under 1GB in use (including
> > > hidden
> > > files). this has happened on the odd occasion in the past and the
> > > only solution appears to be to reboot. Of course, that means I
> > > cannot
> > > provide any more information until it happens again.
> > > 
> > > Has anyone else experienced this or, hopefully, resolved it
> > > without
> > > rebooting?
> 
> > Hey Neil,
> > 
> > Yeah had this a few times. Always turns out to be deleted files
> > that
> > something still has a handle on
> 
> Hah! I never thought of that one. I'll try that next time it happens.


Another common case is that it runs out of inodes, not space,
especially if df actually says there is free spaces. Check
df -i /tmp
instead then - it might tell IFree is 0 and IUsed and Inodes are the
same non-0 value.
The option for this is:

nr_inodes: The maximum number of inodes for this instance. The default
           is half of the number of your physical RAM pages, or (on a
           machine with highmem) the number of lowmem RAM pages,
           whichever is the lower.

And for me with a 32GB tmpfs, it could have easily hit the default
limit when having e.g. firefox + webkit-gtk + chromium or some such
unpacked and built at once, or one of them failed without cleaning up,
etc.
A value of 0 would disable the limit altogether, but this comes with
the caveat of the possibility of a memory DoS when something malicious
could be writing 0 length files in there, because the size limit
doesn't get hit by it, but tracking the inodes does take some memory
itself and there's no inodes limit to deny that at some point then.
So it might be best to figure out some good value for that, perhaps
e.g. 8 times the default (what you see with your tmpfs size under
Inodes column with `df -i /tmp`).


HTH,
Mart

Reply via email to