Controlling size of /tmp over time

Hello,

What is the best and most common way to control the size of the /tmp file?

I had a nasty surprise today when mine maxed out the root partition at after having grown to 8.9gb. I’m running 11.1 and have been using this as my daily desktop machine since December.

TIA for advice and non-Goldberg solutions.

The YaST /etc/sysconfig editor is the tool for this job. Navigate to system → cron. You can set cron.daily to check files within /tmp/ tree and delete after specified time. Check/edit this variable setting:

MAX_DAYS_IN_TMP (by default set to 0 or disabled)

There was a recent thread on the same subject you may be able to search for.

also, in addition to what the poster above said, you can also set in there to clean the /tmp directory on each bootup

You could set the /tmp to be ram based (no need to clean it;))
And you could still control the size it takes :slight_smile:

microchip8 wrote:

>
> also, in addition to what the poster above said, you can also set in
> there to clean the /tmp directory on each bootup

Not very useful for a server - boots are few and far between. Same
reasoning for RAM disk solution.


Will Honea

Then make a separate /tmp mount point and set the desired size.

He is using a desktop and not a server :slight_smile:

And the ram based solution is great by the way (of course if someone got enough memory to sacrifice 100MB or 200MB, but until /tmp would grow to that size it won’t take so much.)

Also,

just an FYI, /tmp is not a file. It is a directory, and preferably a file system. It is important to how the system runs, and is essentially scratch space that is needed for the system, unlike the swap partition/file system that many use (Which is similar to the pagefile on windows, and unlike /tmp)

As others suggested, you should really create a method for managing /tmp and even perhaps move it to a different file system.