I have OpenWRT 18.0.1 installed on a Linksys WRT 3200acm. I have been noticing some problems where some of my services/applications I installed on the router were starting to terminate on their own. Upon investigation, I have noticed that my memory was filling up via the Overview page on the Luci GUI. I then ssh into the router and checked its storage space by doing a df -h:
The area I noticed that was filling up was this line: tmpfs 249.5M 224.6M 228.3M 91% /tmp
Does anyone here know any troubleshooting methods to see what is taking up space in my /tmp directory?
Is there a script I can run that can be setup as a cron job once it hits a certain threshold?
I tried running these commands that usually works with other linux distros to clear out 10-day-old files in the tmp directory but it doesnt seem to work with OpenWRT.
Some of your installed services is probably configured to log too verbosely.
Or creates temp files without cleaning them after use.
Like vgaetera proposes, analyse tmp contents with du to identify possible culprits. Then you could disable the service that you believe is creating the files there, in order to check your hypothesis. And look for ways to decrease logging etc of that app.
That command worked great. I was able to find the application that was configured for debugging back when I was troubleshooting its install.
I was trying to figure out if it was possible to create a script to purge the folder of any directories/files that breach a size threshold, but I think it would be tricky as there are some system files in there that the software/system needs to operate and the other log files would be too specific to target.
I guess for now I will have to do it the manual way and keep an eye on it.
Thank you @tmomas
I was just about to do that. Please feel free to update this with any cleaver scripts or commands that can purge files without having to reboot, it would be awesome
You can out-clever yourself by deleting large files in /tmp/, such as the image you're flashing. Since you know the name(s) of the file(s), I'd look into using logrotate (package) to mange them.