SUSE Support

Here When You Need Us

How to clean temporary files in /tmp and /var/tmp/

This document (000021386) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 15

Situation

Disk usage in /tmp or /var/tmp grows as old files are not removed.

Resolution

To change the behavior and remove files after one day, for example, an administrator can override the configuration by placing a file with the same filename in /etc/tmpfiles.d/ with the same configuration except giving an age argument, in this example, one day (1d):

cat << EOF > /etc/tmpfiles.d/fs-tmp.conf 
q /tmp 1777 root root 1d
EOF

Cause

The default configuration has no cleanup by age set up:

/usr/lib/tmpfiles.d/fs-tmp.conf:q /tmp 1777 root root -

Additional Information

To add debug, create a overwrite file with the following environment setting to the relevant service e.g. systemctl edit systemd-tmpfiles-setup for during boot, or systemctl edit systemd-tmpfiles-clean for daily cleanup:
[Service]
Environment="SYSTEMD_LOG_LEVEL=debug"

 The service systemd-tmpfiles-setup runs during boot. The service systemd-tmpfiles-clean runs by the timer systemd-tmpfiles-clean.timer.

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:000021386
  • Creation Date: 05-Mar-2024
  • Modified Date:14-Mar-2024
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.